Bitbucket | Bamboo

The JDataFrame framework facilitates the representation of data in Java which can be exported as JSON and then converted into a properly formatted data frame in the R Project for Statistical Computing using the RSONIO package.

The JDataFrame framework relies on the Google GSON API for serialization. Developers can use the JDataFrameBuilder to quickly build JDataFrame instances as we have demonstrated in the example R script below:

groovyJars JDataFrameBuilder",
    "def codes = ['WV', 'VA'] as String[]",
    "def descriptions = ['West Virginia', 'Virginia'] as String[]",
    "return new JDataFrameBuilder()",
    ".addColumn('Code', codes)",
    ".addColumn('Description', descriptions)",
    ".toJson()", sep="n")

json RJSONIO::fromJSON(json)
tempDF as.data.frame(temp)

produces the following data frame:

> tempDF
    Description Code
1 West Virginia   WV
2      Virginia   VA

Leave a Reply

Your email address will not be published. Required fields are marked *