Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write R package in Julia?

Tags:

r

rcpp

julia

Is it possible to develop a set of functions in julia (e.g. a specialised optimization algorithm), "compile" it and then use this code from r standalone, i.e. without needing a julia installation?

  • In other words, is it possible to use Julia as we can already use Cpp?

  • Or there plans to support this kind of workflow in the nearer future?

I am aware of the Julia and JuliaCall packages, but I think they were designt for a different kind of workflow.

like image 495
Karsten W. Avatar asked Nov 08 '18 14:11

Karsten W.


People also ask

How do I run an R code in Julia?

Running R Code from JuliaAfter installing and typing using RCall , you'll have access to the R REPL Mode by typing $ . Your prompt will change from julia> to R> and now all of your commands will run in R instead of Julia. You can use it just like a normal R session.

Is Julia better than R?

If most of your works involve complex statistical analysis, then learning R first is probably the better choice. If you want to eventually learn about machine learning or do some text analysis, then perhaps learning Python or Julia first is more effective.


1 Answers

You can use PackageCompiler.jl to generate a shared library which you can call from R or C easily enough (instructions in their readme). The binaries are huge and often still have long start-up times, but there is ongoing, funded work on static compiling in Julia, so this will plausibly get better over the next year or so.

like image 95
cmc Avatar answered Nov 15 '22 06:11

cmc