[R] How to save multiple values of a variable in a json file in R

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu Jan 16 21:10:21 CET 2020


Hi Ioanna,
Assuming your input file is named "ii.json" and contains the text in
your original post:

library(jsonlite)
a2<-fromJSON("ii.json",flatten=TRUE)
a2$fields$geo_applicability$fields$countries[,"fields.name"]

You can find this yourself by progressively checking names and
extracting until you reach the data frame that contains the
information you want. Note that the format of your files must be the
same for this to work on more than one JSON file.

Jim



More information about the R-help mailing list