Shelby McIntyre
2012-Jul-08 13:50 UTC
[R] Reading multiple line from a JSON formatted file
Below is R code that successfully reads the first line of a JSON file (attached). However, it is supposed to read 5 lines of the file, not just one. What is the wrong? ====================>library("rjson") >json_file <- "/Users/smcintyremobile/Google Drive/AAShelby/CORRESP/Services Research/eWoM references for Ed/yelp_academic_dataset SAMPLE.txt" >json_data <- fromJSON(paste(readLines(json_file,n=5), collapse="")) >json_data$votes $votes$funny [1] 1 $votes$useful [1] 8 $votes$cool [1] 1 $user_id [1] "TFm6azL9LLpljgVKx-Vfkw" $name [1] "E L." $url [1] "http://www.yelp.com/user_details?userid=TFm6azL9LLpljgVKx-Vfkw" $average_stars [1] 3.5 $review_count [1] 12 $type [1] "user" -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Yelp-academic-dataset SAMPLE.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120708/407631fe/attachment.txt>