[英]Why can't I download from a link in R markdown?
I tried to run this code in a rmd file but still I'm getting an error and I don't know how to resolve this.我试图在 rmd 文件中运行此代码,但仍然出现错误,我不知道如何解决此问题。 The Code is:
pizza3 <- fromJSON('http://www.jaredlander.com/data/PizzaFavorites.json')
代码是:
pizza3 <- fromJSON('http://www.jaredlander.com/data/PizzaFavorites.json')
And I'm getting an error as:我收到一个错误:
Error in fromJSON("http://www.jaredlander.com/data/PizzaFavorites.json") :
unexpected character 'h' Calls: <Anonymous> ... withCallingHandlers ->
withVisible -> eval -> eval -> fromJSON```
@Rohit this works for me, maybe you haven't loaded jsonlite
as Stéphane has suggested. @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
Created on 2020-02-28 by the reprex package (v0.3.0)由reprex 包(v0.3.0) 于 2020 年 2 月 28 日创建
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.