Linking R and Julia?

后端 未结 8 1331
面向向阳花
面向向阳花 2020-12-22 16:00

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 ti

相关标签:
8条回答
  • 2020-12-22 16:39

    The Julia development plan, as I described in this answer is to allow compilation of Julia code to shared libraries, callable using the C ABI. Once this happens, it will be as easy to call Julia code from R as it is to call C/C++ code. There is, however, a fair amount of work required before this becomes possible.

    0 讨论(0)
  • 2020-12-22 16:39

    Has anyone seen this project?

    https://github.com/armgong/RJulia

    Fairly new but seems to be doing exactly what is requested!

    0 讨论(0)
  • 2020-12-22 16:40

    The RJulia R package looks quite good now from R. R CMD check runs without warnings or errors (if julia is properly installed).

    Biggest TODO in my view is to get Julia to return named lists which constitute the really basic flexible general data structure in R.

    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.

    0 讨论(0)
  • 2020-12-22 16:42

    I create an R package called JuliaCall recently, which embeds Julia in R. The package is on CRAN.

    https://cran.r-project.org/web/packages/JuliaCall/index.html

    https://github.com/Non-Contradiction/JuliaCall

    The usage of the package is like this:

    library(JuliaCall)
    julia <- julia_setup()
    julia_command("a = sqrt(2)"); julia_eval("a")
    julia_eval("sqrt(2)")
    julia_call("sqrt", 2)
    julia_eval("sqrt")(2)
    

    As you can see, you could send command strings and call Julia functions really easily.

    And there are also some R packages wrapping Julia packages using JuliaCall, for example,

    • convexjlr for Disciplined Convex Programming in R using Convex.jl, which is also on CRAN.
    • ipoptjlr, an R Interface for Interior Point OPTimizer (IPOPT) using Julia package Ipopt.jl.

    Welcome for any feedback on JuliaCall!!

    0 讨论(0)
  • 2020-12-22 16:42

    There is also the XRJulia package from XR family of packages aiming to eXtend R by John Chambers (one of the creators of R). It uses a bit different approach (JSON) to transfer data between Julia and R then rJulia and similar packages.

    0 讨论(0)
  • 2020-12-22 16:58

    You also might want to check out my attempt: The JuliaConnectoR R-package. The package is available from GitHub and CRAN.

    It's goal is to import functions from Julia directly in R such that they can be used like R functions in R code. The return values of Julia functions are translated to R data structures, which can be used in R and also be passed back to Julia. For a further integration of Julia and R, it is also possible to call back from Julia to R by passing R functions as callback functions.

    Similar to XRJulia, the JuliaConnectoR relies on TCP, but it is functionally oriented and uses an optimized custom streaming format instead of text-based JSON messages as XRJulia does. One advantage of communicating by TCP is the stability with respect to different versions of Julia and R. This is much harder to maintain with an integration at the level of C interfaces like RCall and JuliaCall do.

    The package works with Julia ≥ 1.0 and a wide range of R versions.

    0 讨论(0)
提交回复
热议问题