json-format in das csv-format-Konvertierung, mit R

Ich habe eine json Datei wie folgt:

library(RCurl)
library(RJSONIO)
url <- 'http://www.pm25.in/api/querys/aqi_details.json?city=shijiazhuang&token=5j1znBVAsnSf5xQyNQyq'
web <- getURL(url)
raw <-fromJSON(web)

Möchte ich es konvertieren in csv-Datei wie folgt:

aqi   area    co     co_24h no2 no2_24h o3 o3_24h o3_8h o3_8h_24h pm10
142   石家庄   1.509  1.412  95      47  3    137    35        90  119
pm10_24h pm2_5 pm2_5_24h position_name primary_pollutant  quality so2
195      80    108       化工学校       颗粒物(PM2.5)       轻度污染 33
so2_24h station_code           time_point
32        1028A 2013-07-15T23:00:00Z

Ich.Daten.frame() und andere Funktionen, aber es hat nicht funktioniert.
Wie kann ich dies tun? Bitte helfen Sie mir, danke.

  • Bitte buchen Sie eine (kleine, reproduzierbare) Beispiel dafür, was das Objekt raw aussieht. Ihre Lösung kann so einfach sein wie write.csv(raw,'raw.csv') je nach dem, was Sie derzeit haben, für die Spalte Namen und so weiter.
InformationsquelleAutor Benyu | 2013-07-15
Schreibe einen Kommentar