2016-07-11 3 views
0

Umwandlung sah ich mehrere Beiträge über json in csv in R Umwandlung, aber ich habe diese Fehler:Fehlermeldung, wenn json in CSV-Datei

Error in fromJSON(file = "C:/users/emily/destop/data.json") : argument "txt" is missing, with no default) after running following code.

mydf <- fromJSON(file= "C:/users/emily/destop/data.json") 

I jsonlite Paket heruntergeladen.

Es scheint, dass der Befehl die json Daten nicht korrekt liest oder nicht in csv Datei konvertieren kann.

Ein paar Beispieldaten aus data.json sieht wie folgt aus:

{"reviewerID": "A3TS466QBAWB9D", "asin": "0014072149", "reviewerName": "Silver Pencil", "helpful": [0, 0], "reviewText": "If you are a serious violin student on a budget, this edition has it all: Piano accompaniment, low price, urtext solo parts, and annotations by Maestro David Oistrakh where Bach's penmanship is hard to decipher. Additions (in dashes) are easily distinguishable from the original bowings. This is a delightful concerto that all intermediate level violinists should perform with a violin buddy. Get your copy, today, along with \"The Green Violin; Theory, Ear Training, and Musicianship for Violinists\" book to prepare for this concerto and for more advanced playing!", "overall": 5.0, "summary": "Perform it with a friend, today!", "unixReviewTime": 1370476800, "reviewTime": "06 6, 2013"} 
{"reviewerID": "A3BUDYITWUSIS7", "asin": "0041291905", "reviewerName": "joyce gabriel cornett", "helpful": [0, 0], "reviewText": "This is and excellent edition and perfectly true to the orchestral version! It makes playing Vivaldi a joy! I uses this for a wedding and was totally satisfied with the accuracy!", "overall": 5.0, "summary": "Vivalldi's Four Seasons", "unixReviewTime": 1381708800, "reviewTime": "10 14, 2013"} 
{"reviewerID": "A2HR0IL3TC4CKL", "asin": "0577088726", "reviewerName": "scarecrow \"scarecrow\"", "helpful": [0, 0], "reviewText": "this was written for Carin Levine in 2008, but not premiered until 2011 at the Musica Viva Fest in Munich. .the work's premise maybe about the arduousness, nefarious of existence, how we all \"Work\" at life, at complexity, at densities of differing lifeworlds. Ferneyhough's music might suggest that these multiple dimensions of an ontology exist in diagonals across differing spectrums of human cognition, how we come to think about an object,aisthetic shaped ones, and expressionistic ones as his music.The work has a nice classical shape,and holds the \"romantic\" at bay; a mere 7 plus minutes for Alto Flute, a neglected wind cadre member.The work has gorgeous arresting moments with a great bounty of extended timbres-pointillistic bursts\" Klangfarben Sehr Kraeftig\" that you do grow weary of; it is almost predictable now hearing these works; you know they will inhabit a dense timbral space of mega-speed lines tossed in all registers;still one listens; that gap Freud speaks about, that we know we need this at some level. . .the music slowed at times for structural rigour.. . we have a dramatic causality at play in the subject,(the work's title) the arduousness of pushing, aspiring, working toward something; pleasurable illuminating or not, How about emancipation from itself;I guess we need forget the production of surplus value herein,even with the rebellions in current urban areas today; It has no place. . . these constructions are leftovers from modernity, the \"gods\" still hover. . .\"gods\" that Ferneyhough has no power to dispel. . . . All are now commonplace for the new music literature of music.This music still sound quite stunning, marvelous and evocative today,it is simple at some level, direct, unencumbered and violent with spit-tongues,gratuitous lines, fluttertongue,percussive slap-keys,tremoli wistful glissandi harmonics, fast filigreed lines, and simply threadbare melos, an austere fragment of what was a melody. . .Claudio Arrau said someplace that the performer the musician must emanate a \"work\" while playing music, a \"struggle\", aesthetic or otherwise, Sviatoslav Richter thought this grotesque, to look at a musician playing the great music. It was ugly for him. . .You can hear Ms.Levine on youtube playing her work, she is quite convincing, you always need to impart an authority,succored in an emotive focus that the music itself has not succumbed to your own possession. You play the music, it doesn't \"play\" you. . . I'd hope though that music with this arduous construction and structural vigour that it would in fact come to possess the performer. . .it is one of the last libidinal pleasures remaining. . .", "overall": 5.0, "summary": "arduous indeed!", "unixReviewTime": 1371168000, "reviewTime": "06 14, 2013"} 
{"reviewerID": "A2DHYD72O52WS5", "asin": "0634029231", "reviewerName": "Amazon Customer \"RCC\"", "helpful": [0, 0], "reviewText": "Greg Koch is a knowledgable and charismatic host. He is seriously fun to watch. The main problem with the video is the format. The lack of on-screen tab is a serious flaw. You have to watch very carefully, have a good understanding of the minor pentatonic, and basic foundation of blues licks to even have a chance at gleening anything from this video.If you're just starting out, pick up the IN THE STYLE OF series. While this series has its limitations (incomplete songs due to copyright, no doubt), it has on screen tab and each lick is played at a reasonably slow speed. In addition, their web site has downloadable tab.However, if you can hold your own in the minor pentatonic, give this a try. It is quite a workout and you'll find yourself a better player having taken on the challenge.", "overall": 3.0, "summary": "GREAT! BUT NOT FOR BEGINNERS.", "unixReviewTime": 1119571200, "reviewTime": "06 24, 2005"} 
{"reviewerID": "A1MUVHT8BONL5K", "asin": "0634029347", "reviewerName": "Amazon Customer \"clapton music fan\"", "helpful": [2, 12], "reviewText": "I bought this DVD and I'm returning it. The description and editorial review are misleading. This is NOT a Clapton video. Certainly some clips from Clapton, but generally this is a \"how to\" video. Same applies to Clapton The Early Years!", "overall": 2.0, "summary": "NOT CLAPTION MUSIC VIDEO! A Learn How To Play Guitar LIKE Clapton", "unixReviewTime": 1129334400, "reviewTime": "10 15, 2005"} 

Schließlich würde Ich mag die Daten korrekt lesen und die Daten in csv-Datei zu konvertieren.

+0

Dieser Fehler ist, weil Sie die Funktion die falsche Argument genannt hat. Lies '? FromJSON' –

Antwort

1

Folgendes sollte

arbeiten
library(RJSONIO) 

# test2.json is a sample json file 
# I removed the reviewText field to keep it short 
# Also tested this out with 1 row of data 
D2 <- RJSONIO::fromJSON("./test2.json") 

# convert the numeric vector helpful to one string 
D2$helpful <- paste(D2$helpful, collapse = " ") 

D2 
    reviewerID  asin   reviewerName helpful 
[1,] "A3TS466QBAWB9D" "0014072149" "Silver Pencil" "0 0" 

D3 <- do.call(cbind, D2) 

write.csv(D3, "D3.csv") 
+0

Koba, ich habe deinen Code ausprobiert und der erste Code D2 <- fromJson funktioniert nicht für meine Daten. Ich habe diesen Fehler -> Fehler in feed_push_parser (readBin (con, roh(), n), Reset = TRUE): Parse-Fehler: Müll reviewTime Hinter ": "10 14 2013"} {" reviewerID ":" A19K10Z0D2NTZK " (hier rechts) ------^ – Emily

+0

Ich kann den Fehler nicht sehen, den Sie eingefügt haben? Können Sie es bitte erneut senden? – Koba

+1

Dieser Code ist erfolgreich auf der Probe mit der fromJSON-Funktion von pkg: RJSONIO vorgestellt, während' jsonlite: : ein Fehler bei fromJSON' warf "' Fehler in feed_push_parser (readBin (con, roh(), n), Reset = TRUE): Verarbeitungsfehler: nachlauf garbage "reviewTime": "06 6 2013"} {" reviewerID ":" A3BUDYITWUSIS7 "'. Meine Vermutung ist, dass @Emily RJSONIO :: fromJSON nicht verwendet hat. –

Verwandte Themen