I streamed a file with 120 JSON objects into R using jsonlite's stream_in()
.
R reports df$rules as a data frame but I cannot seem to be able to access "tag" using df$rules$tag
not df$rules[,2]
.
Here's the structure of rules
within df
:
"rules":{"source":{"rule":"","tag":"tag_1"}}
PS: After writing the question I was able to format it into a data frame (using do.call & rbind.fill) but the question still holds as this is part of a larger data frame from which I want to apply some conditional scripts.
To reformat my question: how can subset the json data frame based on this "tag"?
Update: The above was solved by Jaap's suggest link.
Now I have another problem. I'm looping over many json objects, extracting the above lists and want each to be in the same data frame corresponding, obviously, to the same variable.
Actually I am doing this for several lists arrays within the json objects.
Here's an example (part of a json object).