JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
267 stars 36 forks source link

Error from julia_command() #130

Open fmorgante opened 4 years ago

fmorgante commented 4 years ago

Hello, I am trying to run the following command with JuliaCall and am getting an error. However, when I run the same command directly in Julia 1.4.1, it works fine. I am attaching a reproducible example.

Any help would be appreciated!

> julia_command('add_genotypes(model1,genofile,separator=",");')
The delimiter in genotypes.txt is ','.
The header (marker IDs) is provided in genotypes.txt.
Error: Error happens in Julia.
MethodError: no method matching findfirst(::Array{Any,1}, ::String)
Closest candidates are:
  findfirst(::Union{AbstractString, AbstractArray}) at array.jl:1701
  findfirst(!Matched::Function, ::Union{AbstractString, AbstractArray}) at array.jl:1783
  findfirst(!Matched::Function, ::Any) at array.jl:1776
  ...
Stacktrace:
 [1] _split(::String, ::Array{Any,1}, ::Int64, ::Bool, ::Array{SubString{String},1}) at ./strings/util.jl:327
 [2] split(::String, ::Array{Any,1}; limit::Int64, keepempty::Bool) at ./strings/util.jl:313
 [3] readgenotypes(::String; separator::String, header::Bool, center::Bool) at /Users/fmorgan/.julia/packages/JWAS/4xynz/src/1.JWAS/src/markers/readgenotypes.jl:90
 [4] add_genotypes(::JWAS.MME, ::String, ::Bool; separator::String, header::Bool, center::Bool, G_is_marker_variance::Bool, df::Int64) at /Users/fmorgan/.julia/packages/JWAS/4xynz/src/1.JWAS/src/markers/readgenotypes.jl:61
 [5] top-level scope at none:0
 [6] eval(::Module, ::A
Session Info ```r > sessionInfo() R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: OS X El Capitan 10.11.6 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] JuliaCall_0.17.1 loaded via a namespace (and not attached): [1] compiler_3.5.1 tools_3.5.1 Rcpp_1.0.4.6 knitr_1.28 xfun_0.13 ```

example.R.zip

fmorgante commented 4 years ago

Just to give you additional information, if I put those Julia commands into a Julia script and run it from R using julia_source(), it also works fine. So, it seems to be a problem with julia_command().