5

Is it possible to run R in Processing through rJava/JRI? If I deployed a Processing app on the web, would the client need R on their system?

I'm looking to create an interactive information dashboard that I can deploy on the web. It seems that Processing is probably my best bet for the interactive/web part of things. Unfortunately, it doesn't look like there are many math/stats functions built-in. And there aren't any libraries for plotting data either.

I've been using R and gpplot2 for a few months and am thrilled (amazed) at how easily it manipulates and plots data.

So I'm wondering now if can get the best of both worlds and run R through a Processing applet.

From the JRI website:

JRI is a Java/R Interface, which allows to run R inside Java applications as a single thread. Basically it loads R dynamic library into Java and provides a Java API to R functionality. It supports both simple calls to R functions and a full running REPL.

In a sense JRI is the inverse of rJava and both can be combined (i.e. you can run R code inside JRI that calls back to the JVM via rJava). The JGR project makes the full use of both JRI and rJava to provide a full Java GUI for R.

JRI uses native code, but it supports all platforms where Sun's Java (or compatible) is available, including Windows, Mac OS X, Sun and Linux (both 32-bit and 64-bit).

Thanks for the advice :)

4

3 回答 3

2

你可以在 Processing 中编写 Java 代码(或访问 Jar 文件)吗?如果是这样,那么你绝对可以做到这一点。JRI 为 R 提供了一个低级接口,我还没有遇到 R 中无法通过其函数运行的东西。

有关如何使用它的简单示例,请参阅此相关问题。

除了看几次之外,我并没有真正使用过Processing,但我的理解是它有自己的语言。

于 2010-02-28T03:30:16.843 回答
2

去年我写了一些示例代码:

http://illposed.net/R4P.html

最好的,

布莱恩

于 2010-04-09T22:31:10.680 回答
0

另一种选择是使用 Clojure 的Incanter库。它是 Clojure 中的一个类似 R 的库,由于(纯 Java)Parallel Colt 数字库而非常快,内置 JFreeChart 支持快速图表,以及通过 Clojure 使用处理的包装器。

您可以将生成的应用程序作为普通(尽管可能相当大)Java Applet 推送到网络上。

于 2010-11-07T12:17:01.953 回答