floidgilbert / jdx Goto Github PK
View Code? Open in Web Editor NEWBuilds on the rJava package to simplify and extend data exchange between R and Java.
License: BSD 3-Clause "New" or "Revised" License
Builds on the rJava package to simplify and extend data exchange between R and Java.
License: BSD 3-Clause "New" or "Revised" License
Hi,
Forgive me if this question sounds too basic, but I'm unable to properly frame my problem in google in order to get some bearings on what to do, or if I'm even doing something terribly silly.
I've produced a matrix in R which a colleague needs to use in a java application. I have already passed him the matrix as a .csv and as a .mtx file, but I'm experimenting if it's possible to send him a serialized java object which he can simply consume directly without much overhead on his end.
I went through jdx's vignette but couldn't find insights into how to actually share the objects created.
Following this, I tried the following example:
library(rJava)
library(jdx)
m <- matrix(1:9, nrow = 3, ncol = 3)
mj <- convertToJava(m)
mjs <- jserialize(mj)
But I get:
Error in jserialize(mj) : could not find function "jserialize"
My question is then, considering my R service is not currently integrated with my colleagues java application, how can I share a jclass object created with convertToJava with him?
Also, please feel free to bash me if this is a silly approach to solve this problem and if there's maybe a more efficient/traditional approach to go about this.
From the vignette:
Install jdx with the usual command: install.packages("jdx")
. This command will automatically download and install rJava if necessary. If the rJava installation fails, make sure R is configured to use Java. For Linux/OSX, use sudo R CMD javareconf
. For Windows, open a command prompt "As Administrator" and execute R CMD javareconf
. If there are errors after executing the command, address them, then execute the Java configuration command again. One common error can be resolved by determining whether the GNU Compiler Collection (GCC) is accessible. To check for GCC, execute gcc --help
from a terminal. This command will fail if GCC is not installed or if the license agreement has not been accepted.
jdx fails to install or load due to an rJava error similar to the one below.
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.