From thomas.fuller at coherentlogic.com  Thu Jan 14 22:52:21 2016
From: thomas.fuller at coherentlogic.com (Thomas Fuller)
Date: Thu, 14 Jan 2016 16:52:21 -0500
Subject: [Rd] JDataFrame API
Message-ID: <CAM0JZ3=Xj=c2-VyHO3-8uVjyAgaMoMKr1udnbo4xdvyNEHm55w@mail.gmail.com>

Hi Folks,

If you need to send data from Java to R you may consider using the
JDataFrame API -- which is used to convert data into JSON which then
can be converted into a data frame in R.

Here's the project page:

https://coherentlogic.com/middleware-development/jdataframe/

and here's a partial example which demonstrates what the API looks like:

String result = new JDataFrameBuilder()
    .addColumn("Code", new Object[] {"WV", "VA", })
    .addColumn("Description", new Object[] {"West Virginia", "Virginia"})
    .toJson();

and in R script we would need to do this:

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

which yields a data frame that looks like this:

> tempDF
    Description Code
1 West Virginia   WV
2      Virginia   VA

It is my intention to deploy this project to Maven Central this week,
time permitting.

Questions and comments are welcomed.

Tom



[Rd] JDataFrame API
Thomas Fuller