Learn R Programming

d3Network (version 0.5.2.1)

JSONtoDF: Read a link-node structured JSON file into R as two data frames.

Description

JSONtoDF reads a JSON data file into R and converts part of it to a data frame.

Usage

JSONtoDF(jsonStr = NULL, file = NULL, array)

Arguments

jsonStr
a JSON object to convert. Note if jsonStr is specified, then file must be NULL.
file
character string of the JSON file name. Note if file is specified, then jsonStr must be NULL.
array
character string specifying the name of the JSON array to extract. (JSON arrays are delimited by square brackets).

Source

Part of the idea for the command comes from mropa's comment on StackExchange: http://stackoverflow.com/questions/4227223/r-list-to-data-frame.

Details

JSONtoDF is intended to load JSON files into R and convert them to data frames that can be used to create network graphs. The command converts the files into R lists and then extracts the JSON array the user would like to make into a data frame.