且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数据从 JSON 文件导入 R

更新时间:2022-06-18 21:17:00

首先安装 rjson 包:

First install the rjson package:

install.packages("rjson")

那么:

library("rjson")
json_file <- "http://api.worldbank.org/country?per_page=10&region=OED&lendingtype=LNX&format=json"
json_data <- fromJSON(paste(readLines(json_file), collapse=""))

更新:自 0.2.1 版

json_data <- fromJSON(file=json_file)