[Rd] JDataFrame API
Thomas Fuller
thomas.fuller at coherentlogic.com
Thu Jan 14 22:52:21 CET 2016
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
More information about the R-devel
mailing list