Skip to content
Prev 51321 / 63424 Next

How to efficiently share data (a dataframe) between R and Java

On Dec 6, 2015, at 12:36 PM, Ing. Jaroslav Kucha? <jaroslav.kuchar at fit.cvut.cz> wrote:

            
You can natively access structures on each side. The fastest way is to use R representation (column-oriented) in Java - that is much faster than any kind of serialization or anything you mention above since you pass the variables as a whole.

Typically, the bottleneck are Java applications which may require very inefficient data structures. If you have control over the algorithms, you can simply use proper data structures and avoid that problem. If you don't have control, you'll have to add Java code that converts to whatever structure is needed by the Java code form the data frame pushed to the Java side. The main point here is that you do NOT want to do any conversion on the R side.

Cheers,
?imon