【发布时间】:2016-09-11 20:04:00
【问题描述】:
我正在使用 httr 从 api 访问数据,然后保存该数据,以便我可以开始进行一些数据验证。我在访问我认为的列和行时遇到问题,因为数据已存储为嵌套列表。
query2 <- "this is where my api key in addition to the website I was trying went "
out2 <- GET(url = query2)
http_status(out2)
$category
[1] "Success"
$reason
[1] "OK"
$message
[1] "Success: (200) OK"
dataContent <- content(out2)
names(dataContent)
[1] "Data"
envData <- jsonlite::fromJSON(toJSON(dataContent))
result <- data.frame(envData)
names(result)
[1] "Data.Providers.Name" "Data.Providers.Type"
[3] "Data.Providers.Owner" "Data.Providers.Records"
# when I view the data I can see it in rows and columns
View(result$Data.Providers.Records)
#for some reason its saved as one object and I cannot access individual rows and columns
length(cleanerData)
[1] 1
【问题讨论】:
-
你尝试过索引吗?