For purpose of reading of json file, there are two most popular packages; rjson and jsonlite.
Code for jsonlite looks like:
library("jsonlite")
j <- read_json("path to json file")
j <- as.data.frame(j)
In first line, we are importing actual library. In second line with function read_json() we are going to provide argument of path to json file we want to read, and in third, received structure is converted into data frame.
Code for rjson looks like:
library("rjson")
j <- fromJSON("path to json file")
j <- as.data.frame(j)
Same as in previous case, in first line, library is imported. Function fromJSON, works in the same way as function read_json in previous case, and finally, received structure is going to be converted to data frame as well.
For video tutorial, check the link below.
No comments:
Post a Comment