Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将公共github JSON作为列表列表放入R中?_R_Json - Fatal编程技术网

如何将公共github JSON作为列表列表放入R中?

如何将公共github JSON作为列表列表放入R中?,r,json,R,Json,我想尝试一下Statsbomb在其github页面上公开的一些足球数据。以下是github页面上的一个JSON列表: https://raw.githubusercontent.com/statsbomb/open-data/master/data/events/7298.json 我的问题是,我怎样才能把这个输入R?我尝试了以下方法: httr::contenthttr::GET 然而,这只是返回一个长度为1的字符向量,整个JSON压缩到字符串中。我希望这是一份清单。我怎么能这样做 谢谢 编

我想尝试一下Statsbomb在其github页面上公开的一些足球数据。以下是github页面上的一个JSON列表:

https://raw.githubusercontent.com/statsbomb/open-data/master/data/events/7298.json
我的问题是,我怎样才能把这个输入R?我尝试了以下方法:

httr::contenthttr::GET

然而,这只是返回一个长度为1的字符向量,整个JSON压缩到字符串中。我希望这是一份清单。我怎么能这样做

谢谢


编辑:-如果有帮助的话

如果要将JSON文件转换为R对象,则需要实际解析数据,而不仅仅是将文件下线。jsonlite库使这变得简单

url <- "https://raw.githubusercontent.com/statsbomb/open-data/master/data/events/7298.json"
mydata <- jsonlite::read_json(url)
然后mydata现在是一个包含JSON对象中所有解析值的大列表