Last active
August 29, 2015 14:13
-
-
Save pgtwitter/203cd2c2ff78bcb4c565 to your computer and use it in GitHub Desktop.
sqrt(36)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package rJava; | |
import org.rosuda.JRI.REXP; | |
import org.rosuda.JRI.Rengine; | |
public class RSample { | |
public static void main(String[] args) { | |
System.err.println(System.getenv("R_HOME")); | |
System.err.println(System.getenv("java.library.path")); | |
Rengine engine = new Rengine(new String[] { | |
"--no-save" | |
}, false, null); | |
engine.assign("a", new int[] { | |
36 | |
}); | |
REXP result = engine.eval("sqrt(a)"); | |
System.out.println(result.asDouble()); | |
engine.end(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment