The R package jl4R is devoted to remotely play with julia packages within the R system. The dedicated goal of the package is at some point to replace the use of Rcpp by creating some R wrapper package associated to existing julia packages.
To start presenting the R package jl4R, let us start with some very basic session.
require(jl4R) v_jl <- jl(c(1,3,2)) v_jl jltypeof(v_jl) length(v_jl) v_jl[2] jltypeof(v_jl[2]) R(v_jl) # ou toR(v_jl)
R> require(jl4R) R> v_jl <- jl(c(1,3,2)) R> v_jl 3-element Vector{Float64}: 1.0 3.0 2.0 R> jltypeof(v_jl) Vector{Float64} (alias for Array{Float64, 1}) R> length(v_jl) [1] 3 R> v_jl[2] 3.0 R> jltypeof(v_jl[2]) Float64 R> R(v_jl) # ou toR(v_jl) [1] 1 3 2
Internally, an julia instance (here an Array) is represented as an externalptr
typeof(v_jl) class(v_jl)
R> typeof(v_jl) [1] "externalptr" R> class(v_jl) [1] "Array" "jlvalue"