Message-ID: <CAM0JZ3=Xj=c2-VyHO3-8uVjyAgaMoMKr1udnbo4xdvyNEHm55w@mail.gmail.com>
Date: 2016-01-14T21:52:21Z
From: Thomas Fuller
Subject: JDataFrame API
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