Git Product home page Git Product logo

juliacall's Issues

Composite types and call-overloading

I would like to see if I could get full compatibility with the ODESolution object of DifferentialEquations.jl. Right now diffeqr is avoiding this by returning a list of two arrays from that solution object. However, it would be better if it could return that full type. Is there a way to define auto-wrapper types for Julia types to have the same fields in an R object?

Additionally, this type has call-overloading so that way sol(t) is an interpolation. Is there a way to keep these function overloads in whatever auto-wrapper type?

Consider using stopifnot

I noticed that your code has sections like

    if (!(length(func_name) == 1 && is.character(func_name))) {
        stop("func_name should be a character scalar.")
    }
    if (!(is.list(arg_list))) {
        stop("arg_list should be the list of arguments.")
    }
    if (!(length(show_value) == 1 && is.logical(show_value))) {
        stop("show_value should be a logical scalar.")
    }

The stopifnot function was created so you can collapse that to

   stopifnot(length(func_name) == 1, is.character(func_name), is.list(arg_list), 
       length(show_value) == 1, is.logical(show_value))

Problem with setup.jl

I am unable to use the package due to an error while loading setup.jl.

When I run this script directly in Julia, it run normally, however when I try to use the JuliaCall library in R, I get the following error:


C:\Users\Administrador>"C:\Users\Administrador\AppData\Local\Julia-0.6.4\bin\jul
ia.exe" "C:\Program Files\R\R-3.4.3\library\JuliaCall\julia\setup.jl"
ERROR: LoadError: RCall not properly installed. Please run Pkg.build("RCall")
Stacktrace:
[1] error(::String) at .\error.jl:21
[2] include_from_node1(::String) at .\loading.jl:576
[3] include(::String) at .\sysimg.jl:14
[4] anonymous at .<missing>:2
while loading C:\Users\Administrador.julia\v0.6\RCall\src\RCall.jl, in expressi
on starting on line 40
ERROR: LoadError: Failed to precompile RCall to C:\Users\Administrador.julia\li
b\v0.6\RCall.ji.
Stacktrace:
[1] compilecache(::String) at .\loading.jl:710
[2] _require(::Symbol) at .\loading.jl:497
[3] require(::Symbol) at .\loading.jl:405
[4] include_from_node1(::String) at .\loading.jl:576
[5] include(::String) at .\sysimg.jl:14
[6] process_options(::Base.JLOptions) at .\client.jl:305
[7] _start() at .\client.jl:371
while loading C:\Program Files\R\R-3.4.3\library\JuliaCall\julia\setup.jl, in ex
pression starting on line 20


I ran the commands Pkg.build("RCall") and Pkg.test("RCall") in Julia and did not get an error

I am using R 3.4.3 and Julia 0.6.4

package development and accessing Julia function

Hi:
There is an online vignette which states the following: "Basically you only need to find the Julia function or Julia module you want to have in R and then just using the module and call the function. Several examples are..."

Since this is critical to package development, I am hoping you can provide a working example. Here is one such function that I want to use in R:

function BB_est(x, sims)
X = center_data(x)
n = size(X, 1)
p = size(X, 2)

offdiag = (p * (p - 1)) / 2

loop_max = convert(Int64, offdiag)

temp = Exponential(1)
exp_drw = rand(temp, n * sims)

rexp_mat = reshape(exp_drw, sims, n)
dir_weights = rexp_mat ./sum(rexp_mat, 2)

A = zeros(sims, offdiag)
B = zeros((1, offdiag))
C = zeros(sims, p)
mat_point = zeros(p,p)
mat_sig = zeros(p, p)
idx = tril(trues(size(mat_point)), -1);

for i = 1:sims
t = dir_weights[i, 1:n]
d = X .* sqrt.(t)
bb_cov = (d' * d)
inv_cov =  inv(bb_cov)
d = diag(inv_cov)
inv_cov[diagind(inv_cov)] = 0

test = inv_cov[idx]
rmv_0 = filter!(x->x≠ 0,test)
A[i,:] = rmv_0
C[i,:] = d
end

 for i in 1:loop_max
temp1 =  quantile(A[:,i], 0.025)
temp2 =  quantile(A[:,i], 0.975)
B[1,i] = ifelse(temp1 < 0 && temp2 > 0, 0, 1)
end

mat_sig[idx] = B
mat_point[idx] = mean(A, 1)
mat_point[diagind(mat_point)] = mean(C, 1)
force_sym(mat_sig), force_sym(mat_point)
end

function col_means(x)
 mean(x, 1)
end

function center_data(x)
 x .- col_means(x)
 end

Note that I have some user defined functions within this function, and using the Distributions package. The x is for a matrix of dimensions n * p, and sims is the number of iterations. Interestingly, in Julia, the speed gains are huge compared to R, so really hoping to get some info on this ;-)

Thank you in advance

Compilation Error in julia_setup()

After I set the LD_LIBRARY_PATH as suggested, I encounter some error in julia_setup():

Error in compileCode(f, code, language, verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /storage/work/cxl508/julia/julia-0.6.0/include/julia/julia.h:59,
from file55844d10aec.cpp:12:
/storage/work/cxl508/julia/julia-0.6.0/include/julia/julia_threads.h: In function ‘int8_t jl_gc_state_set(jl_tls_states_t*, int8_t, int8_t)’:
/storage/work/cxl508/julia/julia-0.6.0/include/julia/julia_threads.h:480: error: ‘__ATOMIC_SEQ_CST’ was not declared in this scope
/storage/work/cxl508/julia/julia-0.6.0/include/julia/julia_threads.h:480: error: ‘__atomic_signal_fence’ was not declared in this scope

And a lot of similar error like this.

The sessionInfo is:

sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.9 (Santiago)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.4.0

Check libR when `julia_setup()`?

During the julia_setup(), although it checks whether the Rhome is the current R, it doesn't check whether libR is valid, so we have problems like #44, which is caused by libR not available. I plan to add libR check during julia_setup() and if libR is not there or too old, gives error message about libR. Given the validate_libR function in RCall.jl, it should be really easy to do so.

And I'm wondering whether the check should be incorporated into RCall.jl. If the Rhome is set, but libR is not available or too old, RCall.jl will install R through Conda currently without any information about the libR problem. But if the user sets the Rhome variable, it seems that the user wants to use the R at that location, would it make more sense to throw an error in this case instead of installing R through Conda? @randy3k What do you think?

Add juliarc.jl at julia startup

Adding juliarc.jl at start up helps if e.g. a custom path for the package folder is defined there.

I run into the issue trying to use Julia Call with juliapro 6.2 on Windows Server 2012, where the package folder is JULIA_HOME/.pkgs--.6.2.1. Including juliarc.j into the JuliaCall's setup.jl made the package folder visible. Though I'm not shure if it is the best solution.

And thank you for a great package. It has a true potential to replace Rcpp, at least for me.

Best
Dmitri

R.app GUI cannot find julia?

On mac in R.app GUI, when I try to use JuliaCall, I encounter a problem:
/bin/sh: julia: command not found
even julia is on the path. Can't reproduce this error in terminal or RStudio.

sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] zh_CN.UTF-8/zh_CN.UTF-8/zh_CN.UTF-8/C/zh_CN.UTF-8/zh_CN.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.4.1

Segmentation fault from JuliaCall

In answer to Changcheng's latest questions (we have been communicating by email up to now):

(1) Could you check the R used by Julia? For example, in Julia, you can type in the following:
julia> using RCall
julia> RCall.Rhome

Did that. Got "/home/rolf/.julia/v0.6/Conda/deps/usr/lib/R"

(2) And check if the RCall.Rhome matches the position of the correct R.

Well there is an R there. It appears to be a copy of the R that my "system" runs,
i.e. is /usr/local/bin/R. Same version (3.4.3) at least.
I'm not sure why this copy exists. Probably came from my issuing the command
Pkg.add("RCall") in Julia.

(3) If RCall.Rhome is correct, do you have any startup file for R? Like any function to execute or package to load at the beginning?

Yes I have a file .Rprofile which does load packages. But that makes "using RCall"
throw an error. So I quit Julia, moved .Rprofile to save.Rprofile, restarted Julia
and got the results shown in (1).

Got a warning, as I have previously mentioned by email, about Rcpp:

Warning: namespace ‘Rcpp’ is not available and has been replaced
by .GlobalEnv when processing object ‘.__C__Rcpp_stan_fit4model355f633685f5_file355f517a8896’

Don't understand this. I have Rcpp installed. (Ah! Just realised: it's installed in own private
library, which Julia doesn't know about.)

I'll see if I can get it installed in the "public library" and see what happens then.

JuliaObject cannot distinguish things like 1.0 and 1

For example, currently julia_eval("(1.0,2.0)") and julia_eval("(1,2)") being the same object
This is because in the current implementation of JuliaObject, julia dictionary is used and it only distinguishes object at == level, this may cause a lot of potential very very serious problems. I think it may be the root for #13

julia_setup() hanging after message on "Loading setup script"

I haven't work out what is triggering this but I sometimes have R hang after a call to julia_setup. It looks like

> library(JuliaCall)      
> j <- julia_setup()      
Julia version 0.6.2 at location /usr/local/src/julia-d386e40c17/bin will be used.                        
Julia initiation...       
Finish Julia initiation.  
Loading setup script for JuliaCall... 
Segmentation fault (core dumped)

The last line was printed after a very long wait (like hours).

Some of the time I avoid the segfault in the REPL. Inside RStudio I almost always segfault.

This is on an Ubuntu 17.10 64-bit system with R version 3.4.4 (2018-03-15) -- "Someone to Lean On" and official download of Julia v0.6.2

I know this isn't much to go on. Please let me know if I can do some further exploration.

Using rice, JuliaCall and PyCall together cause segfault.

@randy3k

Maybe here is a better place to discuss the problem.

When I have segfault, the last lines of error look like this:

signal (11): Segmentation fault: 11
while loading no file, in expression starting on line 0
tupledealloc at /anaconda/lib/libpython3.6m.dylib (unknown line)
code_dealloc at /anaconda/lib/libpython3.6m.dylib (unknown line)
pydecref at /Users/lichangcheng/.julia/v0.6/PyCall/src/PyCall.jl:96
unknown function (ip: 0x11eb0a2e2)

I think this should be reproduced by

Python -> import julia -> julia -> using PyCall -> exit julia

But to my surprise, when I exit julia in pyjulia, python ends as well as julia.

Problematic Automatic Differentiation

Julia Automatic Differentiation becomes possible because of the R method dispatching system and type conversion in RCall and JuliaCall.

But currently there is a lot of problems:

library(JuliaCall)
julia_setup()
julia_library("ForwardDiff")
f <- function(x) sum(x^2L)
julia_assign("ff", f)
julia_command("g = x -> ForwardDiff.gradient(ff, x);")
julia_command("g([2.0])")
## 1-element Array{Float64,1}:
## 4.0
  
julia_command("g([3.0])")
## 1-element Array{Float64,1}:
## 6.0
  
## This is problematic, don't know why, but it seems like a problem related to integer?
julia_command("g([4.0])")
## 1-element Array{Float64,1}:
## 32.0
  
## This works as expected.
julia_command("g([4.01])")
## 1-element Array{Float64,1}:
## 8.02
  
## This doesn't work also...
julia_command("g([1.01,4.01])")
## Error: Error happens when you try to call function sum in Julia.
## DimensionMismatch("dimensions must match")

## But this works...
julia_command("g([1.01,2.01])")
## 2-element Array{Float64,1}:
## 2.02
## 4.02
  
## And this doesn't work!!!
julia_command("g([1.01,2.0])")
## Error: Error happens when you try to call function sum in Julia.
## DimensionMismatch("dimensions must match")
  
julia_command("g([3.01,2.01])")
## 2-element Array{Float64,1}:
## 6.02
## 4.02

Sending Functions

How exactly does sending a function work. If you've defined a function in R, can you just send it like any other variable? Will the get JIT compiled and specialized just like any other Julia function?

GPL license

As we are using Rcpp, we may need to switch to GPL license as most R packages do.

A trick to bypass julia #14577?

Because of julia issue #14577,
non-precompiled packages cannot be imported in embedding julia v0.6,
so currently using XXX in JuliaCall doesn't work if package XXX is non-precompiled.
This problem results in many other problems, related to #10 #34 #40 for example.

This problem exists because of the incorrect JULIA_HOME for embedding julia.
I read the source of julia, and find that functions like Base.compilecache depends on function julia_cmd, and inspired by Revise.jl, we can actually use @eval Base julia_cmd() = ..... to modify this function to be the correct version to "solve" this problem in a tricky way, for example:

> julia_command('Base.compilecache("Suppressor")')
INFO: Precompiling module Suppressor.
Error happens in Julia.
could not spawn `/Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia -Ccore2 -J/Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib --compile=yes --depwarn=yes -O0 --output-ji /Users/lichangcheng/.julia/lib/v0.6/Suppressor.ji --output-incremental=yes --startup-file=no --history-file=no --color=no --eval 'while !eof(STDIN)
    eval(Main, deserialize(STDIN))
end
'`: permission denied (EACCES)
Stacktrace:
 [1] _jl_spawn(::String, ::Array{String,1}, ::Ptr{Void}, ::Base.Process, ::Base.PipeEndpoint, ::Ptr{Void}, ::Ptr{Void}) at ./process.jl:360
 [2] #374 at ./process.jl:512 [inlined]
 [3] setup_stdio(::Base.##374#375{Cmd}, ::Tuple{Pipe,Base.PipeEndpoint,Base.PipeEndpoint}) at ./process.jl:499
 [4] #spawn#373(::Nullable{Base.ProcessChain}, ::Function, ::Cmd, ::Tuple{Pipe,Base.PipeEndpoint,Base.PipeEndpoint}) at ./process.jl:511
 [5] (::Base.#kw##spawn)(::Array{Any,1}, ::Base.#spawn, ::Cmd, ::Tuple{Pipe,Base.PipeEndpoint,Base.Pip
> julia_command('Base.julia_cmd()')
`/Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia -Ccore2 -J/Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib --compile=yes --depwarn=yes`
  
> julia_command('@eval Base julia_cmd() = `/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia -Ccore2 -J/Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib --compile=yes --depwarn=yes`')
WARNING: Method definition julia_cmd() in module Base at util.jl:604 overwritten at none:1.
julia_cmd (generic function with 2 methods)
  
> julia_command('Base.compilecache("Suppressor")')
INFO: Precompiling module Suppressor.
"/Users/lichangcheng/.julia/lib/v0.6/Suppressor.ji"

I'm wondering if this kind of method worths the trouble it may bring.
Any opinion is welcomed.

`julia_setup` crashes `rtichoke`

library(JuliaCall)
julia_setup()

will cause rtichoke to crash.

Detailed information:

client-130-203-170-72:~ lichangcheng$ rtichoke
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Platform: x86_64-apple-darwin15.6.0 (64-bit)

r$> library(JuliaCall)                                                          

r$> julia_setup()                                                               
Julia version 0.6.2 at location /Applications/Julia-0.6.app/Contents/Resources/julia/bin will be used.
Julia initiation...
Finish Julia initiation.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.

r$>                                                                             
                                                                                
                                                                                
                                                                                
                                                                          raceba
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/appl
    result = yield f
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/even
    new_f = coroutine.send(None)
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/appl
    self._redraw()
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/appl
    self.renderer.render(self, self.layout)
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/rend
    output.flush()
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/outp
    self.stdout.flush()
BlockingIOError: [Errno 35] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/rtichokeapp.py", line 19
    text = mp.run()
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/modalprompt.py", line 26
    return self.app.run(inputhook=self.inputhook)
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/appl
    return run()
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/appl
    return f.result()
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/even
    raise self._exception
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/even
    new_f = coroutine.throw(exc)
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/deps/prompt_toolkit/appl
    assert not self._is_running
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/callbacks.py", line 17, 
    unexpected error was caught.ODING), add_history)
  File "/anaconda3/lib/python3.6/site-packages/rtichoke/rtichokeapp.py", line 20

....
....

Julia exit.
client-130-203-170-72:~ lichangcheng$ 4;1R

Segfault caused by failing in conversion of R arguments

Currently in docall function in setup.jl,

call = transfer_list(call1)
fname = call[:fname];
named_args = call[:named_args]
unamed_args = call[:unamed_args]
need_return = call[:need_return];
show_value = call[:show_value];

is not wrapped by try catch, which could cause segfault error if anything is wrong in this part.

print() prints nothing in R Markdown

I found this code chunk won't return any output:

```{julia}
print(1)
```

Isn't this a bug? Or an usual behaviour of print()? Sorry, I'm totally a newbie to Julia...

Problems related to diag on JuliaObject

Things like diag(JuliaObject(3)) behave as expected, but other things are not.
Need to find a way to deal with this.
This also may affect autodiffr's ability to deal with functions using diag.

when using JuliaCall in R: Error in inDL (x, as.logical(local), as.logical(now), ...) : character argument expected

  • Background

I'm using R version 3.5.1 (2018-07-02), where the R.exe is in C:\Program Files\R\R-3.5.1\bin
and Julia Version 0.7.0, where julia.exe is in C:\Users\carol\AppData\Local\Julia-0.7.0\bin

I download the JuliaCall using install.packages("JuliaCall"), library location is C:/Users/carol/Documents/R/win-library/3.5

  • Issue
    In R:
    julia <- julia_setup() or
    julia <- julia_setup(JULIA_HOME = "C:\\Users\\carol\\AppData\\Local\\Julia-0.7.0\\bin")
    it shows:
    Julia version 0.7.0 at location C:\Users\carol\AppData\Local\JULIA-~2.0\bin will be used. Error in inDL(x, as.logical(local), as.logical(now), ...) : character argument expected (JULIA-~2.0 equals Julia-0.7.0)

  • Note
    library(JuliaCall) works fine;
    I can use other library (eg. ggplot2) without error above.

Do I need to add some path in System variables/user variables?
Can someone tell me what's wrong? thanks!

Strang text when loading JuliaCall on Windows via RStudio

> library(JuliaCall)
> julia_setup()
Julia version 0.6.1 at location C:\Users\IEUser\AppData\Local\JULIA-~1.1\bin will be used.
Julia initiation...
Finish Julia initiation.
Loading setup script for JuliaCall...
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
Finish loading setup script for JuliaCall.
> 

It may be related to KristofferC/OhMyREPL.jl#14
and the @suppress macro at

@suppress begin

PS: it works perfectly on Rgui.

drop RCall dependencies and more refactoring

In the current implementation of JuliaCall, RCall.jl is required for converting objects between R and Julia environments. While it may be sufficient for most operations, it does however lead to some performance bottlenecks and creates difficulties in maintenance. For instance, any upgrades in RCall may unintentionally break JuliaCall. I reckon that we should drop RCall dependencies and implement our own conversion procedure. It allows us

  1. to significantly improve setup time
  2. to easily maintain as the implement is independent to RCall (of course, we want to make sure JuliaCall is compatible with RCall).

The conversion code could be written in a similar manner as
https://github.com/armgong/rjulia. rjulia requires an installation of Julia in the build time. It could be potentially difficult for non-techinical users and it also makes CRAN submission difficult. Via my PR #22, the shared library is loaded at runtime and no julia instllation is needed. As a result, users could download a binary version from CRAN directly.

It could be a major refactoring. Instead of working on the current version of JuliaCall, I suggest we should start a new organization, hypothetically juliaverse

At RJuliaCall juliaverse, we split the JuliaCall into sub-packages

  1. juliaapi
    this package basically just expose the julia C api and allows developers to manipulate julia. It will be basically what I have done in #22

  2. juliabase
    this package depends on juliaapi and supports conversions of julia base types. For example, conversions between julia Array{Float64} and R numeric().

  3. juliadata
    It supports the packages at https://github.com/JuliaData

  4. juliaverse
    It is a mega package containing all the above packages + additional supports, e.g. jupyter. (I personally prefer lower-cased package name and it seems it is also the common practice nowadays to use lower-cased package name)

@Non-Contradiction what do you think about the plan? I also want to bring in @armgong since we will probably use some code in rjulia.

Error in assigning JuliaObject to a variable in R

The following problem occurs:

> library(JuliaCall)
> julia_setup()
Julia at location /Applications/Julia-0.6.app/Contents/Resources/julia/bin will be used.
Julia version 0.6.1 found.
Julia initiation...
Finish Julia initiation.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.
> julia_command("type Mytype
+               num::Int
+               den::Int
+               ans::Float64
+               end")
> julia_eval("Mytype(1, 12, 1/12)")
Julia Object of type Mytype.
Mytype(1, 12, 0.08333333333333333)
> r = julia_eval("Mytype(1, 12, 1/12)")
Error: Error happens in Julia.
MethodError: no method matching length(::Mytype)
Closest candidates are:
  length(!Matched::SimpleVector) at essentials.jl:256
  length(!Matched::Base.MethodList) at reflection.jl:558
  length(!Matched::MethodTable) at reflection.jl:634
  ...
Stacktrace:
 [1] docall(::Ptr{Void}) at /Users/lichangcheng/Library/R/3.4/library/JuliaCall/julia/setup.jl:71
> r
Julia Object of type Mytype.
Mytype(1, 12, 0.08333333333333333)

Errors in julia_setup() and Pkg.add("Suppressor")

Error in julia_setup():

> julia_setup()
Julia version 0.6.0 at location D:\JuliaPro-0.6.0.1\Julia-0.6.0\bin will be used.
Julia initiation...
Finish Julia initiation.
Loading setup script for JuliaCall...
Error in .julia$cmd(paste0("include(\"", system.file("julia/setup.jl",  : 
  Error happens when you try to execute command include("D:/.exploratory/R/3.4/JuliaCall/julia/setup.jl") in Julia.
                        To have more helpful error messages,
                        you could considering running the command in Julia directly
In addition: Warning message:
running command '"D:\JuliaPro-0.6.0.1\Julia-0.6.0\bin/julia" "D:/.exploratory/R/3.4/JuliaCall/julia/install_dependency.jl" "D:/R/R-3.4.3"' had status 1 

Further error info:

julia> include("D:/.exploratory/R/3.4/JuliaCall/julia/setup.jl")
WARNING: replacing module JuliaPro
WARNING: replacing module JuliaCall
ERROR: LoadError: ArgumentError: Module Suppressor not found in current path.
Run `Pkg.add("Suppressor")` to install the Suppressor package.
Stacktrace:
 [1] _require(::Symbol) at .\loading.jl:428
 [2] require(::Symbol) at .\loading.jl:398
 [3] include_from_node1(::String) at .\loading.jl:569
 [4] include(::String) at .\sysimg.jl:14
while loading D:\.exploratory\R\3.4\JuliaCall\julia\setup.jl, in expression starting on line 10

Error in Pkg.add("Suppressor"):

julia> Pkg.add("Suppressor")
INFO: Cloning cache of Suppressor from https://github.com/Ismael-VC/Suppressor.jl.git
ERROR: Cannot clone Suppressor from https://github.com/Ismael-VC/Suppressor.jl.git. user cancelled certificate check:
prefetch(::String, ::String, ::Array{String,1}) at .\pkg\cache.jl:56
resolve(::Dict{String,Base.Pkg.Types.VersionSet}, ::Dict{String,Dict{VersionNumber,Base.Pkg.Types.Available}}, ::Dict{String,Tuple{VersionNumber,Bool}}, ::Dict{
String,Base.Pkg.Types.Fixed}, ::Dict{String,VersionNumber}, ::Set{String}) at .\pkg\entry.jl:516
resolve(::Dict{String,Base.Pkg.Types.VersionSet}, ::Dict{String,Dict{VersionNumb
er,Base.Pkg.Types.Available}}, ::Dict{String,Tuple{VersionNumber,Bool}}, ::Dict{
String,Base.Pkg.Types.Fixed}) at .\pkg\entry.jl:479
edit(::Function, ::String, ::Base.Pkg.Types.VersionSet, ::Vararg{Base.Pkg.Types.
VersionSet,N} where N) at .\pkg\entry.jl:30
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at .\task.jl:335
Stacktrace:
 [1] sync_end() at .\task.jl:287
 [2] macro expansion at .\task.jl:303 [inlined]
 [3] add(::String, ::Base.Pkg.Types.VersionSet) at .\pkg\entry.jl:51
 [4] (::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at .\pkg\dir.jl:33
 [5] cd(::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at .\file.jl:59
 [6] withenv(::Base.Pkg.Dir.##2#5{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String},String}, ::Pair{String,String}, ::Vararg{Pair{String,String},N} where N) at .\env.jl:157
 [7] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N}where N) at .\pkg\dir.jl:32
 [8] add(::String) at .\pkg\pkg.jl:117

julia_setup() not working with R 3.5.1 and Julia 1.0

The following error message appears when running julia_setup() with R 3.5.1 and Julia 1.0.

Julia version 1.0.0 at location /opt/julia/bin will be used.
Loading setup script for JuliaCall...
ERROR: LoadError: LoadError: UndefVarError: endof not defined
Stacktrace:
[1] getproperty(::Module, ::Symbol) at ./sysimg.jl:13
[2] top-level scope at none:0
[3] include at ./boot.jl:317 [inlined]
[4] include_relative(::Module, ::String) at ./loading.jl:1038
[5] include at ./sysimg.jl:29 [inlined]
[6] include(::String) at /home/simon/.julia/packages/AxisArrays/uZ7JS/src/AxisArrays.jl:3
[7] top-level scope at none:0
[8] include at ./boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1038
[10] include(::Module, ::String) at ./sysimg.jl:29
[11] top-level scope at none:2
[12] eval at ./boot.jl:319 [inlined]
[13] eval(::Expr) at ./client.jl:389
[14] top-level scope at ./none:3
in expression starting at /home/simon/.julia/packages/AxisArrays/uZ7JS/src/core.jl:59
in expression starting at /home/simon/.julia/packages/AxisArrays/uZ7JS/src/AxisArrays.jl:18
ERROR: LoadError: Failed to precompile AxisArrays [39de3d68-74b9-583c-8d2d-e117c070f3a9] to /home/simon/.julia/compiled/v1.0/AxisArrays/zm48T.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] macro expansion at ./logging.jl:313 [inlined]
[3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
[4] _require(::Base.PkgId) at ./logging.jl:311
[5] require(::Base.PkgId) at ./loading.jl:852
[6] macro expansion at ./logging.jl:311 [inlined]
[7] require(::Module, ::Symbol) at ./loading.jl:834
[8] include at ./boot.jl:317 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1038
[10] include(::Module, ::String) at ./sysimg.jl:29
[11] top-level scope at none:2
[12] eval at ./boot.jl:319 [inlined]
[13] eval(::Expr) at ./client.jl:389
[14] top-level scope at ./none:3
in expression starting at /home/simon/.julia/packages/RCall/6RPqA/src/RCall.jl:11
LoadError("/home/simon/R/x86_64-pc-linux-gnu-library/3.5/JuliaCall/julia/setup.jl", 62, ErrorException("Failed to precompile RCall [6f49c342-dc21-5d91-9882-a32aef131414] to /home/simon/.julia/compiled/v1.0/RCall/8GFyb.ji.")) Error in .julia$cmd(paste0("Base.include(Main,"", system.file("julia/setup.jl", :
Error happens when you try to execute command Base.include(Main,"/home/simon/R/x86_64-pc-linux-gnu-library/3.5/JuliaCall/julia/setup.jl") in Julia.
To have more helpful error messages,
you could considering running the command in Julia directly
In addition: Warning message:
In system2(file.path(.julia$bin_dir, "julia"), shQuote(command), :
running command ''/opt/julia/bin/julia' '/home/simon/R/x86_64-pc-linux-gnu-library/3.5/JuliaCall/julia/install_dependency.jl' '/usr/lib/R' 2>&1' had status 1

Back-and-Forth Conversion of List of JuliaObject

This is quite a big problem and should be a main goal for JuliaCall 1.0.
The problem is that any julia object that can not convert into ordinary R object will be converted into JuliaObject in R, which is an S3 class. And an array containing such things in julia will be converted into an list of JuliaObject in R. And when you want to convert the things back, you will get Array{Any} in julia from the list in R.

Segmentation fault caused by Libdl.dlpath("libjulia")

The position of libjulia is needed for startup of JuliaCall and is located by Libdl.dlpath("libjulia"). But on some linux machines, the command seems to cause segmentation fault.
Need to have an alternative way to locate libjulia.
Currently allowing a new argument libjulia for julia_setup() in case the above mechanism breaks.

Should JuliaArray exist at all?

Current JuliaArray's implementation is quite inefficient. Besides, there seems no reason for JuliaArray to exist.

The element of JuliaArray may be JuliaObject, and currently there is no way for JuliaObject to be garbage collected in Julia, maybe we could implement JuliaObject by R6 class to deal with this. Too many JuliaObject may cause some issues like stackoverflow.

And the conversion of JuliaArray between R and Julia is slow and take too much memory (related to last problem).

If JuliaArray exists, the behavior of R generic functions on JuliaArray should be dispatched to Julia function mostly (except [ and [[?). Basically, there seems no benefit of JuliaArray. So why don't we change JuliaArray to JuliaObject?

Using knitr chunks caching feature with Julia via JuliaCall knitr engine

How can I use knitr caching feature with Julia via JuliaCall. Tell me, please, how can I achieve that, if it is possible?

And one more question is if it is possible to speed up loading Julia setup script? These two questions are relevant to each other in the aspect that I'm looking for speeding up my document build.

Cannot exit julia_console in Jupyter R Notebook

When I test JuliaCall in Jupyter R Notebook. I find that the basic functionality of JuliaCall is ok, the display is working and so are packages like Gadfly and Plots.

And one interesting fact is that julia_console also works in Jupyter R Notebook, and the whole console will be in one Jupyter cell including all the commands and plots. But I cannot quit from julia_console and things like exit quit have no effect at all.

Pushing an R formula to Julia

I was planning on submitting a PR but I haven't been able to work out where this happens.

@randy3k has added a capability to the development version of RCall to convert an R formula to a Julia formula with rcopy.

julia> using RCall

julia> rcopy(R"y ~ 1 + service + (1|s) + (1|d) + (1|dept)")
Formula: y ~ 1 + service + (1 | s) + (1 | d) + (1 | dept)

I haven't been able to work out how to hook into this rcopy conversion to "push" an R formula to Julia through JuliaCall. If, for example, I use julia_assign with the second argument being an R formula it ends up in Julia as a Ptr{LangSxp} rather than running through the rcopy conversion.

From my point of view, using rcopy can "pull" an R formula to Julia but I don't know how to "push" one through JuliaCall.

julia_setup fails when Julia linked to MKL?

julia <- julia_setup()
Julia version 0.7.0-DEV.1856 found.
Julia initiation...
WARNING: Error during initialization of module LinAlg:
ErrorException("could not load library "libmkl_rt"
libmkl_rt.so: cannot open shared object file: No such file or directory")
Finish Julia initiation.
Loading setup script for JuliaCall...
UndefVarError(:include) Error in .julia$cmd(paste0("include(\"", system.file("julia/setup.jl",  : 
  Error happens when you try to execute command include("/home/celrod/R/x86_64-pc-linux-gnu-library/3.4/JuliaCall/julia/setup.jl") in Julia.
In addition: Warning messages:
1: In utils::compareVersion(x, y) : NAs introduced by coercion
2: In utils::compareVersion(x, y) : NAs introduced by coercion

A friend got the same result when it found a JuliaPro v0.6.0 install connected to MKL.
On my home computer (built with OpenBLAS), it worked.

I also have an OpenBLAS install at my school computer. As the error says:
could not load library "libmkl_rt"
It seems highly likely it is related. I'll pass that install's path to julia_call and confirm it works

Also! Saying julia_setup is time consuming seems like an understatement.
Is that likely to change? Launching a Julia REPL and recompiling both Gadfly and Plots.jl seems faster. Have you profiled the function? What is it doing?

Need to Implement R's internal generics for JuliaObject

According to R's documentation for internal generic

The following primitive and internal functions are generic, i.e., you can write methods for them:

[, [[, $, [<-, [[<-, $<-,

length, length<-, dimnames, dimnames<-, dim, dim<-, names, names<-, levels<-,

c, unlist, cbind, rbind,

as.character, as.complex, as.double, as.integer, as.logical, as.raw, as.vector, is.array, is.matrix, is.na, is.nan, is.numeric, rep, seq.int (which dispatches methods for "seq") and xtfrm

In addition, is.name is a synonym for is.symbol and dispatches methods for the latter. Similarly, as.numeric is a synonym for as.double and dispatches methods for the latter, i.e., S3 methods are for as.double, whereas S4 methods are to be written for as.numeric.

Note that all of the group generic functions are also internal/primitive and allow methods to be written for them.

.S3PrimitiveGenerics is a character vector listing the primitives which are internal generic and not group generic. Currently as.vector, cbind, rbind and unlist are the internal non-primitive functions which are internally generic.

Installation error on Windows 10

Steps:

install.packages("JuliaCall")
library(JuliaCall)
julia <- julia_setup()

Error in julia_setup() : Julia is not found.

Julia was installed using the standard generic binary.

Add support for Rnw latex files in JuliaCall knitr engine

First of all, thanks for your work. I much appreciate the ability to use Julia with knitR.

I'd like to open this issue as a feature request. The feature under consideration is support for Rnw latex files in JuliaCall knitr engine.

We had a short discussion here, where I reported a problem I faced when I knit Rnw file with pure Julia chunks.

Unable to load libjulia.so because `GLIBCXX_3.4.20' not found

After library(JuliaCall) and julia_setup(), I encountered this error:

Error in dyn.load(.julia$dll_file, FALSE, TRUE) :
unable to load shared object '/storage/work/cxl508/julia/julia-0.6.0/bin/../lib/libjulia.so.0.6':
/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /storage/work/cxl508/julia/julia-0.6.0/bin/../lib/libjulia.so.0.6)

And this is the sessionInfo:

sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.9 (Santiago)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] JuliaCall_0.7.3

loaded via a namespace (and not attached):
[1] compiler_3.4.0

More generics for JuliaObject

More generics on JuliaObject, need to implement

  • determinant
  • as.vector

Update
Also need to implement

  • is.XXX
  • diff

And have more correct implementation for generics like max and min.

round-trip of array with axis names comes back without names

RCall can import an R array as a NamedArray or as an AxisArray, keeping the dimnames.

reval("x = matrix(1:6,ncol=3, dimnames=list(a=letters[1:2],b=LETTERS[1:3]))")
y rcopy(NamedArray,"x")
y = y + 20
@rput y
rcopy(AxisArray,R"y")

JuliaCall could be made to do the same trick
x = matrix(1:6,ncol=3,dimnames=list(a=letters[1:2], b=LETTERS[1:3]))
julia_command('rcopy(AxisArray,R"x")') # So far, so good, dimnames intact
julia_eval("x") # dimnames gone

Maybe I'm missing a trick here, but I think JuliaCall is dropping the dimnames.

Segmentation fault on Ubuntu 16.04 (64-bit), Julia 0.6.1

The issue

Running julia_setup() with both CRAN and master version of JuliaCall yields something like this:

> julia_setup()
Julia version 0.6.1 at location /opt/julia/bin will be used.
Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7fe5aef1de4f)
Allocations: 815461 (Pool: 814408; Big: 1053); GC: 0
Segmentation fault (core dumped)
Julia initiation...
Error in juliacall_initialize(.julia$dll_file) : 
Expecting a single string value: [type=character; extent=0].
In addition: Warning message:
running command ''/opt/julia/bin/julia' '-e' 'print(Libdl.dlpath("libjulia"))'' had status 139 

Logs by devtools::check()

00install.out:

* using log directory ‘/tmp/RtmpThQ8H9/JuliaCall.Rcheck’
* using R version 3.4.3 (2017-11-30)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using options ‘--no-manual --as-cran’
* checking for file ‘JuliaCall/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘JuliaCall’ version ‘0.12.0.9000’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘JuliaCall’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking compiled code ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
testthat results ================================================================
OK: 12 SKIPPED: 0 FAILED: 12
1. Error: test of the JuliaObject (@test_JuliaObject.R#5) 
2. Error: test of JuliaTuple (@test_JuliaTuple.R#5) 
3. Error: test of using RCall through JuliaCall (@test_RCall.R#5) 
4. Error: test of the asR functions (@test_asR.R#5) 
5. Error: test of the basic functionality (@test_basic.R#5) 
6. Error: test of basic generics (@test_dispatch.R#32) 
7. Error: test of Compare group (@test_dispatch.R#51) 
8. Error: test of Arith group (@test_dispatch.R#63) 
9. Error: test of Logic group (@test_dispatch.R#76) 
1. ...

Error: testthat unit tests failed
Execution halted
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking re-building of vignette outputs ... OK
* DONE
Status: 1 ERROR

testthat.Rout.fail:

R version 3.4.3 (2017-11-30) -- "Kite-Eating Tree"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(JuliaCall)
> test_check("JuliaCall")
Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f285acfde4f)
Allocations: 815450 (Pool: 814396; Big: 1054); GC: 0
Segmentation fault (core dumped)
�[31m1. Error: test of the JuliaObject (@test_JuliaObject.R#5) �[39m----------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_JuliaObject.R:5
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f4537c08e4f)
Allocations: 815449 (Pool: 814396; Big: 1053); GC: 0
Segmentation fault (core dumped)
�[31m2. Error: test of JuliaTuple (@test_JuliaTuple.R#5) �[39m----------------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_JuliaTuple.R:5
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f7a4325fe4f)
Allocations: 815450 (Pool: 814396; Big: 1054); GC: 0
Segmentation fault (core dumped)
�[31m3. Error: test of using RCall through JuliaCall (@test_RCall.R#5) �[39m--------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_RCall.R:5
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f0d10344e4f)
Allocations: 815449 (Pool: 814396; Big: 1053); GC: 0
Segmentation fault (core dumped)
�[31m4. Error: test of the asR functions (@test_asR.R#5) �[39m----------------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_asR.R:5
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f5fa38d5e4f)
Allocations: 815450 (Pool: 814396; Big: 1054); GC: 0
Segmentation fault (core dumped)
�[31m5. Error: test of the basic functionality (@test_basic.R#5) �[39m--------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_basic.R:5
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f6333040e4f)
Allocations: 815449 (Pool: 814396; Big: 1053); GC: 0
Segmentation fault (core dumped)
�[31m6. Error: test of basic generics (@test_dispatch.R#32) �[39m-------------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_dispatch.R:32
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7fb4088bfe4f)
Allocations: 815451 (Pool: 814396; Big: 1055); GC: 0
Segmentation fault (core dumped)
�[31m7. Error: test of Compare group (@test_dispatch.R#51) �[39m--------------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_dispatch.R:51
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7fbe4bf1ee4f)
Allocations: 815449 (Pool: 814396; Big: 1053); GC: 0
Segmentation fault (core dumped)
�[31m8. Error: test of Arith group (@test_dispatch.R#63) �[39m----------------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_dispatch.R:63
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7eff6a13ce4f)
Allocations: 815451 (Pool: 814396; Big: 1055); GC: 0
Segmentation fault (core dumped)
�[31m9. Error: test of Logic group (@test_dispatch.R#76) �[39m----------------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_dispatch.R:76
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f1054cc9e4f)
Allocations: 815449 (Pool: 814396; Big: 1053); GC: 0
Segmentation fault (core dumped)
�[31m10. Error: test of Math and Math2 group (@test_dispatch.R#84) �[39m------------------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_dispatch.R:84
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f9acc406e4f)
Allocations: 815450 (Pool: 814396; Big: 1054); GC: 0
Segmentation fault (core dumped)
�[31m11. Error: test of the error handling functionality (@test_error.R#5) �[39m----------
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_error.R:5
2: juliacall_initialize(.julia$dll_file)

Two passes with the same argument (-LowerSIMDLoop) attempted to be registered!

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f688f504e4f)
Allocations: 815449 (Pool: 814396; Big: 1053); GC: 0
Segmentation fault (core dumped)
�[31m12. Error: test of functionality related to julia_package (@test_julia_package.R#5) �[39m
Expecting a single string value: [type=character; extent=0].
1: julia_setup() at testthat/test_julia_package.R:5
2: juliacall_initialize(.julia$dll_file)

testthat results ================================================================
OK: 12 SKIPPED: 0 FAILED: 12
1. Error: test of the JuliaObject (@test_JuliaObject.R#5) 
2. Error: test of JuliaTuple (@test_JuliaTuple.R#5) 
3. Error: test of using RCall through JuliaCall (@test_RCall.R#5) 
4. Error: test of the asR functions (@test_asR.R#5) 
5. Error: test of the basic functionality (@test_basic.R#5) 
6. Error: test of basic generics (@test_dispatch.R#32) 
7. Error: test of Compare group (@test_dispatch.R#51) 
8. Error: test of Arith group (@test_dispatch.R#63) 
9. Error: test of Logic group (@test_dispatch.R#76) 
1. ...

Error: testthat unit tests failed
Execution halted

Tuples

Is there a way to define tuples in R that works through the assign interface? I would like to write something with R variables that can do: julia_eval("tspan = (0.0,1.0)")

Capturing Julia output

I am having difficulty deciding how to capture Julia output from a Julia print or similar call in an Rmd document. See http://rpubs.com/dmbates/377897 where I try to print

j$eval("print(fm1)")

(just before the section on "Fitting the model in Julia using RCall"). The output from that chunk appears in the RStudio R Markdown console, not in the document.

Also, if there are parts of my explanation of how to use JuliaCall that you would like changed, please let me know.

speed up RCall checking

With the current version of RCall, there is no need to load RCall to check R_HOME, you could actually load the deps.jl file (if it exists) to check if RCall is built with the current R distribution,

julia> include(Base.Pkg.dir("RCall", "deps", "deps.jl"));

julia> Rhome
"/Library/Frameworks/R.framework/Resources"

It should speed up the setup script significantly.

Also, since JuliaInterop/RCall.jl#229, if the R versions do not match, you should run

Pkg.build("RCall")

instead of Base.compilecache("RCall")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.