为什么我不能从 R markdown 中的 link 下载?
Why can't I download from a link in R markdown?
我试图在 rmd 文件中 运行 这段代码,但我仍然遇到错误,我不知道如何解决这个问题。
代码是:
pizza3 <- fromJSON('http://www.jaredlander.com/data/PizzaFavorites.json')
我收到一个错误:
Error in fromJSON("http://www.jaredlander.com/data/PizzaFavorites.json") :
unexpected character 'h' Calls: <Anonymous> ... withCallingHandlers ->
withVisible -> eval -> eval -> fromJSON```
@Rohit 这对我有用,也许你没有像 Stéphane 建议的那样加载 jsonlite
。
library(jsonlite)
pizza3 <- jsonlite::fromJSON("http://www.jaredlander.com/data/PizzaFavorites.json")
pizza3
#> Name Details
#> 1 Di Fara Pizza 1424 Avenue J, Brooklyn, NY, 11230
#> 2 Fiore's Pizza 165 Bleecker St, New York, NY, 10012
#> 3 Juliana's 19 Old Fulton St, Brooklyn, NY, 11201
#> 4 Keste Pizza & Vino 271 Bleecker St, New York, NY, 10014
#> 5 L & B Spumoni Gardens 2725 86th St, Brooklyn, NY, 11223
#> 6 New York Pizza Suprema 413 8th Ave, New York, NY, 10001
#> 7 Paulie Gee's 60 Greenpoint Ave, Brooklyn, NY, 11222
#> 8 Ribalta 48 E 12th St, New York, NY, 10003
#> 9 Totonno's 1524 Neptune Ave, Brooklyn, NY, 11224
由 reprex package (v0.3.0)
于 2020-02-28 创建
我试图在 rmd 文件中 运行 这段代码,但我仍然遇到错误,我不知道如何解决这个问题。
代码是:
pizza3 <- fromJSON('http://www.jaredlander.com/data/PizzaFavorites.json')
我收到一个错误:
Error in fromJSON("http://www.jaredlander.com/data/PizzaFavorites.json") :
unexpected character 'h' Calls: <Anonymous> ... withCallingHandlers ->
withVisible -> eval -> eval -> fromJSON```
@Rohit 这对我有用,也许你没有像 Stéphane 建议的那样加载 jsonlite
。
library(jsonlite)
pizza3 <- jsonlite::fromJSON("http://www.jaredlander.com/data/PizzaFavorites.json")
pizza3
#> Name Details
#> 1 Di Fara Pizza 1424 Avenue J, Brooklyn, NY, 11230
#> 2 Fiore's Pizza 165 Bleecker St, New York, NY, 10012
#> 3 Juliana's 19 Old Fulton St, Brooklyn, NY, 11201
#> 4 Keste Pizza & Vino 271 Bleecker St, New York, NY, 10014
#> 5 L & B Spumoni Gardens 2725 86th St, Brooklyn, NY, 11223
#> 6 New York Pizza Suprema 413 8th Ave, New York, NY, 10001
#> 7 Paulie Gee's 60 Greenpoint Ave, Brooklyn, NY, 11222
#> 8 Ribalta 48 E 12th St, New York, NY, 10003
#> 9 Totonno's 1524 Neptune Ave, Brooklyn, NY, 11224
由 reprex package (v0.3.0)
于 2020-02-28 创建