Last active
August 25, 2016 23:32
-
-
Save lakshmanok/ee0ca916da848508c341a0e062d21644 to your computer and use it in GitHub Desktop.
Running R programs at scale using Dataflow
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
| double[] inputx = c.element(); // from input | |
| engine.put("x", inputx); | |
| // run R program, get output from R, send to Dataflow | |
| ListVector result = (ListVector) engine.eval(new InputStreamReader(rprog)); | |
| double pvalue = result.getElementAsDouble(1); |
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
| library(exptest) | |
| co.exp.test(x, simulate.p.value=FALSE, nrepl=2000) |
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
| <repositories> | |
| <repository> | |
| <id>bedatadriven</id> | |
| <name>bedatadriven public repo</name> | |
| <url>https://nexus.bedatadriven.com/content/groups/public/</url> | |
| </repository> | |
| </repositories> | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.renjin</groupId> | |
| <artifactId>renjin-script-engine</artifactId> | |
| <version>RELEASE</version> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.renjin.cran</groupId> | |
| <artifactId>exptest</artifactId> | |
| <version>1.2-b214</version> | |
| </dependency> | |
| <!-- rest of your dependencies go here --> |
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
| ScriptEngineManager manager = new ScriptEngineManager(); | |
| ScriptEngine engine = manager.getEngineByName("Renjin"); | |
| InputStream rprog = CallingRFromJava.class.getResourceAsStream("myprog.r"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment