rjulia-package: rjulia helps integrating R and Julia by calling Julia from R

Description Details Author(s) References See Also Examples

Description

RJulia (R package name rjulia) provides an interface between R and Julia by converting R and Julia objects mutually, and running Julia scripts from R.

R is a sophisticated feature-rich statistical software but a bit slow, julia is new advanced computing language which is fast and LLVM-based JIT. So, combining R and julia will allow us to do better statistical computing.

Details

Package: rjulia
Type: Package
Version: 1.0
License: GPL 2

TODO: An overview of how to use the package, including the most important functions.

Author(s)

Yu Gong armgong@yahoo.com

References

Online Julia Documentation, at http://docs.julialang.org.

See Also

j2r, r2j; further julia_init, julia_eval,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(cc <- j2r(  "cos(pi * (0 : 0.5 : 4))"))
all.equal(cc, cos(pi * seq(0,4, by=0.5))) # TRUE indeed

j2r("float(1//2 + 2//3)") # Julia knows rationals numbers, i.e., ratios of integers

## Julia has builtin "Bigfloat" data type with 256 bits precision:
(pi. <- j2r("string(big(pi))"))

## if you really have problems getting R to call Julia, try ...

 if(is(T1 <- tryCatch(julia_init(), error=function(e)e), "error")) {
    ## try harder
    juliaDIR <- dirname(system("which julia", intern=TRUE))
    message("Trying Julia directory ", juliaDIR)
    if(is(T2 <- tryCatch(julia_init(juliaDIR), error=function(e)e), "error")) {
      ## TODO: show error messages of  T1 and T2
      warning("Did not succeed to initialize  Rjulia with correct julia directory yet")
    }
    else {
      message(" Success !!")
      julia_eval("1+1")
      ## julia_eval("2^20")
    }
 }

armgong/rjulia documentation built on May 10, 2019, 1:41 p.m.