gpt4 book ai didi

java - 通过 rJava/JRI 在处理中使用 R?

转载 作者:搜寻专家 更新时间:2023-10-31 20:16:17 25 4
gpt4 key购买 nike

是否可以通过 rJava/JRI 在 Processing 中运行 R?如果我在 Web 上部署了一个 Processing 应用程序,客户是否需要在他们的系统上使用 R?

我想创建一个可以在网络上部署的交互式信息仪表板。看来 Processing 可能是我对事物的交互/网络部分的最佳选择。不幸的是,它看起来并没有很多内置的数学/统计函数。而且也没有任何用于绘制数据的库。

我已经使用 R 和 gpplot2 几个月了,我很高兴(惊奇)它如此轻松地处理和绘制数据。

所以我现在想知道是否可以两全其美并通过 Processing applet 运行 R。

来自JRI网站:

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).

感谢您的建议:)

最佳答案

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

参见 this related question有关如何使用它的简单示例。

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

关于java - 通过 rJava/JRI 在处理中使用 R?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2349820/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com