连接 R 和 Julia? [英] Linking R and Julia?
问题描述
Julia 在快速和语法健全的计算方面看起来非常有前途(例如 这里),但我怀疑在一段时间内就整体统计工作流程而言,它不会接近 R.所以我想在 C++ 主要用于 R 程序的地方使用它:优化代码的慢部分.不过,在我花时间学习 Julia 之前,我很好奇有哪些工具可以将 Julia 片段嵌入到 R 代码中.
Julia looks very promising for fast and syntax-sane computation (e.g. here), but I suspect it will not be anywhere near R in terms of overall statistics workflow for some time yet. So I'd like to use it where C++ is mainly used in R programs: to optimize slow portions of code. Before I invest the time in learning Julia, though, I am curious what facilities there are for embedding Julia snippets in R code.
所以:
- 有哪些工具可以连接 R 和 Julia?
- 在从零到 Rcpp 的范围内,它们的稳健性和深思熟虑程度如何?
我想从 R 中调用 Julia,就像 Rcpp 现在允许从 R 中调用 C++一样.我不想给 Julia 打电话.(所以 RCall.jl 不起作用)
I want to call Julia from R, just as Rcpp allows calling C++ from within R right now. I do not want to call R from Julia. (So RCall.jl would not work)
推荐答案
RJulia R 包看起来不错现在从 R 开始好.R CMD check
运行时没有警告或错误(如果正确安装了 julia
).
The RJulia R package looks quite good now from R. R CMD check
runs without warnings or errors (if julia
is properly installed).
在我看来,最大的 TODO 是让 Julia 返回命名列表,这些列表构成了 R 中真正基本的灵活通用数据结构.
Biggest TODO in my view is to get Julia to return named lists which constitute the really basic flexible general data structure in R.
请注意,Doug Bates 提醒我有关 RCall 是从 Julia 到 R 的双向接口(即,除了 R 到 Julia 的另一个方向).此外,Doug 建议针对 julia 0.4.0 而不是当前的稳定版 julia.
Note that Doug Bates alerted me about RCall a bi-directional interface from Julia to R (i.e., the other direction than R to Julia). Also, Doug recommended to target julia 0.4.0 rather than the current stable versions of julia.
自上述编写以来,又出现了几个接口:现在(2021-04),我们有 R 包
Several more interfaces have appeared since the above was written: Now (2021-04), we've got R packages
JuliaCall
(~2017) 将 Julia 嵌入到 R 中,并且得到积极维护可从 CRAN 获得.JuliaConnectoR
(~2019),也可从CRAN 目标更高,例如,直接将 julia 对象导入 R
JuliaCall
(~2017) which embeds Julia in R, and is actively maintained available from CRAN.JuliaConnectoR
(~2019), also available from CRAN which aims even higher, e.g., directly importing julia objects into R
这篇关于连接 R 和 Julia?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!