Operation on an RObject{RealSxp} Created Using RCall

Hello All,

New to Julia: I am using Julia to develop a large Monte Carlo simulation investigating the robustness of several statistical procedures. I created a couple of variables (vector) from the skew-normal distribution using RCall (using the package “sn”). Now, I am trying to select simple random samples from those vector (called X1 and X2) using several of the versions of the sample function and keep getting the following massage: Sampler for this object is not defined I haven’t been able to find a reference on how to work with RObjects in Julia, if one exits. Any feedback will be greatly appreciated.

The RObject is only accessible in the R process that is started by RCall. Most of the time when using RCall you rcopy an object to the Julia session if you want to use it in Julia. For example

julia> using RCall
[ Info: Precompiling RCall [6f49c342-dc21-5d91-9882-a32aef131414]

julia> R"rnorm(4)"
RObject{RealSxp}
[1] -0.3539573 -0.4693315  1.7016331  1.6902909


julia> v = rcopy(ans)
4-element Array{Float64,1}:
 -0.3539572923325208
 -0.46933145235119395
  1.7016330529402308
  1.6902908525686313

The first output is from R and is just showing what the vector looks like in R. Calling rcopy(ans) copies the R vector to a Vector in Julia.

In general you would wrap the expression to generate the vector in a call to rcopy, as in

julia> v1 = rcopy(R"runif(4)")
4-element Array{Float64,1}:
 0.6790683544240892
 0.377434688154608
 0.29283377691172063
 0.04867288493551314

I’m just showing it in two stages here to emphasize where the vectors reside.