Reading a huge json file in R , issues

后端 未结 3 1239
北荒
北荒 2020-12-30 11:17

I am trying to read very huge json file using R , and I am using the RJSON library with this commend json_data <- fromJSON(paste(readLines(\"myfile.json\"), collaps

3条回答
  •  星月不相逢
    2020-12-30 11:44

    For some reason the above solutions all caused R to terminate or worse.

    This solution worked for me, with the same data set:

    library(jsonlite)
    file_name <- 'C:/Users/Downloads/yelp_dataset/yelp_dataset~/dataset/business.JSON'
    business<-jsonlite::stream_in(textConnection(readLines(file_name, n=100000)),verbose=F)
    

    Took about 15 minutes

提交回复
热议问题