JDataFrame Example
An example of the JDataFrame being used in the R Project for Statistical Computing.

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 RJSONIO package.

The JDataFrame project and source code can be found on Bitbucket.

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 <- list (




script <- paste (
    "@Grab(group='com.coherentlogic.r.integration', module='jdataframe-core', version='0.8.5-RELEASE')",
    "import com.coherentlogic.r.integration.data.frame.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 <- rGroovy::Evaluate(groovyScript = script)

temp <- 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

Close Menu
Close Panel