Export JSON from Spark and input into R

后端 未结 1 1797
野趣味
野趣味 2021-01-26 15:11

I\'ve written some data from Spark to a JSON file and I am struggling to import it into R.

I cannot import it with any of the traditional JSON packages in R:

<         


        
相关标签:
1条回答
  • 2021-01-26 15:56

    It turns out that Spark exports streaming json files like those discussed in the following question: Error parsing JSON file with the jsonlite package

    The solution is to use jsonlite's streaming function:

    library(jsonlite)
    json_file <- stream_in(file("win_rate_sample.json"))
    
    0 讨论(0)
提交回复
热议问题