我試圖將Json輸出轉換爲數據幀。 JSON的輸出如下R將Json輸出轉換爲數據幀
[[1]]
[[1]]$id
[1] "176248"
[[1]]$report_list_id
[[1]]$report_list_id[[1]]
[1] "183556"
[[1]]$name
[1] "Torchy's Tacos"
[[2]]
[[2]]$id
[1] "180642"
[[2]]$report_list_id
[[2]]$report_list_id[[1]]
[1] "188160"
[[2]]$name
[1] "CircusTrix"
,我使用如下
library(jsonlite)
library(httr)
library(RJSONIO)
x= content(dash)$data
xx <- data.frame(do.call(rbind, x))
但是代碼,這段代碼不能選擇不公開某些列,並將所得DF看起來是這樣的。
id
report_list_id
name
1
176248
list("183556")
Torchy's Tacos
2
180642
list("188160")
CircusTrix
有沒有更好的方法來將Json轉換爲DF,以避免這些問題。
可以添加您的JSON輸出的'dput'結果嗎? – Deena
@Dee我不太確定dput結果的含義。將Json轉換爲DF的最佳方法是什麼? – rrodrigorn0
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Deena