r_julia: Send R Objects to Julia

Description Usage Arguments Value See Also Examples

Description

Send R object x to julia, i.e., translate it to a corresponding julia object, and store that as y.

Usage

1
2
r_julia(x, y)  # or shorter
    r2j(x, y)

Arguments

x

an R object. Currently must fulfill certain properties to be translatable to Julia.

y

a character string; the variable name on the Julia side.

Value

on success, NULL, invisibly.

See Also

j2r aka julia_eval for the reverse of this.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## assign R's pi to Julia, as "Rpi"
r2j(pi, "Rpi")
j2r("pi") # Julia's builtin pi
## is there a difference
j2r("Rpi - pi") # typically 0

## integer vector:
r2j(1:10, "i10")
j2r("i10") ; stopifnot(identical(1:10, j2r("i10")))

## matrix, passed to Julia and got back
m <- matrix(exp(-5:6), 3,4)
r2j(m, "m")
stopifnot(identical(m, j2r("m")))

## complex -- not yet _FIXME_
z <- complex(modulus = 4, argument = pi*(0:16)/8)
r2j(z, "z") # does *not* work ! but gives no error
if(FALSE)
  stopifnot(identical(z, j2r("z")))
try( j2r( "z" ) )# ->  "... undefined"

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