Seamless Integration Between R and 'Julia'

Provides an R interface to 'Julia', which is a high-level, high-performance dynamic programming language for numerical computing, see <> for more information. It provides a high-level interface as well as a low-level interface. Using the high level interface, you could call any 'Julia' function just like any R function with automatic type conversion. Using the low level interface, you could deal with C-level SEXP directly while enjoying the convenience of using a high-level programming language like 'Julia'.

Travis-CI BuildStatus AppVeyor BuildStatus CRAN_Status_Badge

[Table of Contents]

Package JuliaCall is an R interface to Julia, which is a high-level, high-performance dynamic programming language for numerical computing, see for more information. Below is an image for Mandelbrot set. JuliaCall brings more than 100 times speedup of the calculation! See for more information.


To use package JuliaCall, you first have to install Julia on your computer, you can download a generic binary from and add it to your path, and then you can install JuliaCall just like any other R packages by


Note that currently Julia v0.6.x, Julia v0.7.0 and Julia v1.0 are all supported by JuliaCall. But note that some Julia packages may not work on Julia v1.0 and you may need to use Julia v0.7.0 for transition purposes.

You can get the development version of JuliaCall by


Basic Usage

## Do initial setup
julia <- julia_setup()
#> Julia version 1.0.0 at location /Applications/ will be used.
#> Loading setup script for JuliaCall...
#> Finish loading setup script for JuliaCall.
## If you want to use a julia at a specific location, you could do the following:
## julia_setup(JULIA_HOME = "the folder that contains julia binary"), 
## or you can set JULIA_HOME in command line environment or use `options(...)`
## Different ways for using Julia to calculate sqrt(2)
# julia$command("a = sqrt(2);"); julia$eval("a")
julia_command("a = sqrt(2);"); julia_eval("a")
#> [1] 1.414214
#> [1] 1.414214
julia_call("sqrt", 2)
#> [1] 1.414214
#> [1] 1.414214
julia_assign("x", sqrt(2)); julia_eval("x")
#> [1] 1.414214
julia_assign("rsqrt", sqrt); julia_call("rsqrt", 2)
#> [1] 1.414214
2 %>J% sqrt
#> [1] 1.414214
## You can use `julia$exists` as `exists` in R to test
## whether a function or name exists in Julia or not
#> [1] TRUE
#> [1] FALSE
## Functions related to installing and using Julia packages
#> [1] "0.16.0"

Trouble Shooting and Way to Get Help

Julia is not found

Make sure the Julia installation is correct. JuliaCall is able to find Julia on PATH, and there are three ways for JuliaCall to find Julia not on PATH.

  • Use julia_setup(JULIA_HOME = "the folder that contains julia binary")
  • Use options(JULIA_HOME = "the folder that contains julia binary")
  • Set JULIA_HOME in command line environment.

How to Get Help

  • One way to get help for julia functions is just using julia$help like the following example:
#> ```
#> sqrt(x)
#> ```
#> Return $\sqrt{x}$. Throws [`DomainError`](@ref) for negative [`Real`](@ref) arguments. Use complex negative arguments instead. The prefix operator `√` is equivalent to `sqrt`.
#> # Examples
#> ```jldoctest; filter = r"Stacktrace:(\n \[[0-9]+\].*)*"
#> julia> sqrt(big(81))
#> 9.0
#> julia> sqrt(big(-81))
#> ERROR: DomainError with -8.1e+01:
#> NaN result for non-NaN input.
#> Stacktrace:
#>  [1] sqrt(::BigFloat) at ./mpfr.jl:501
#> [...]
#> julia> sqrt(big(complex(-81)))
#> 0.0 + 9.0im
#> ```
#> ```
#> sqrt(A::AbstractMatrix)
#> ```
#> If `A` has no negative real eigenvalues, compute the principal matrix square root of `A`, that is the unique matrix $X$ with eigenvalues having positive real part such that $X^2 = A$. Otherwise, a nonprincipal square root is returned.
#> If `A` is symmetric or Hermitian, its eigendecomposition ([`eigen`](@ref)) is used to compute the square root. Otherwise, the square root is determined by means of the Björck-Hammarling method [^BH83], which computes the complex Schur form ([`schur`](@ref)) and then the complex square root of the triangular factor.
#> [^BH83]: Åke Björck and Sven Hammarling, "A Schur method for the square root of a matrix", Linear Algebra and its Applications, 52-53, 1983, 127-140. [doi:10.1016/0024-3795(83)80010-X](
#> # Examples
#> ```jldoctest
#> julia> A = [4 0; 0 4]
#> 2×2 Array{Int64,2}:
#>  4  0
#>  0  4
#> julia> sqrt(A)
#> 2×2 Array{Float64,2}:
#>  2.0  0.0
#>  0.0  2.0
#> ```

JuliaCall for R Package Developers

If you are interested in developing an R package which is an interface for a Julia package, JuliaCall is an ideal choice for that!

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:

  • diffeqr is a package for solving differential equations in R. It utilizes DifferentialEquations.jl for its core routines to give high performance solving of ordinary differential equations (ODEs), stochastic differential equations (SDEs), delay differential equations (DDEs), and differential-algebraic equations (DAEs) directly in R.
  • convexjlr is an R package for Disciplined Convex Programming (DCP) by providing a high level wrapper for Julia package Convex.jl. convexjlr can solve linear programs, second order cone programs, semidefinite programs, exponential cone programs, mixed-integer linear programs, and some other DCP-compliant convex programs through Convex.jl.
  • ipoptjlr provides an R interface to the Ipopt nonlinear optimization solver. It provides a simple high-level wrapper for Julia package [Ipopt.jl] (
  • Julia MixedModels from R illustrates how to use JuliaCall and Julia package MixedModels.jl to build mixed models in R.
  • autodiffr provides automatic differentiation to native R functions by wrapping Julia packages ForwardDiff.jl and ReverseDiff.jl through JuliaCall, which is a work in progress.

If you have any issues in developing an R package using JuliaCall, you may report it using the link: Or email me at [email protected] or [email protected].

Suggestion and Issue Reporting

JuliaCall is under active development now. Any suggestion or issue reporting is welcome! You may report it using the link: Or email me at [email protected] or [email protected].

And if you encounter some issues which crash R or RStudio, then you may have met segfault errors. I am very sorry. And I am trying my best to remove errors like that. It will be much appreciated if you can

  • download the source of JuliaCall from Github,
  • open JuliaCall.Rproj in your RStudio or open R from the directory where you download the source of JuliaCall,
  • run devtools::check() to see the result of R CMD check for JuliaCall on your machine,
  • and paste the result to the issue report.

Interfaces between R and Julia

  • RCall.jl is a Julia package which embeds R in Julia. JuliaCall is inspired by RCall.jl and depends on RCall.jl for many functionalities like much of the type conversion between R and Julia.
  • XRJulia is an R package based on John Chambers’ XR package and allow for structured integration of R with Julia. It connects to Julia and uses JSON to transfer data between Julia and R.
  • RJulia is an R package which embeds Julia in R as well as JuliaCall. It is not on CRAN yet and I haven’t tested it.



  • More deprecation warning fixed for Julia v0.7/1.0.

JuliaCall 0.16.0

  • Ninth release on CRAN.


  • More deprecation warning fixed for Julia v0.7.
  • JuliaCall is now compatible with RCall v0.11.0 on Julia v0.7.
  • Fix the problem caused by the failure of"RCall").
  • Fix various small issues in Julia v1.0.
  • Fix a segfault on Windows with Julia v0.7 and v1.0.
  • JuliaCall now should be usable on Julia v0.7 and Julia v1.0 with released version of RCall.
  • Fix issue #65 in julia_source on Julia v0.7 and v1.0.
  • Remove julia_check which is deprecated a long time ago.


  • Some performance improvements.
  • Add install argument in julia_setup(), setting it to FALSE can reduce startup time when no installation or checking of dependent Julia packages is needed.
  • Improve julia_console().

JuliaCall 0.15.0

  • Eighth release on CRAN.


  • Try to remove R6 dependency to reduce overhead creating JuliaObject.
  • Compatibility with Julia v0.7, currently need to use RCall#e59a546 with JuliaCall on Julia v0.7.
  • Deprecation fixing with Julia v0.7.
  • Implementation of diff.JuliaObject.


  • Match the assignment behavior for JuliaObject to that in native R.
  • Implementation of generics for is.numeric for JuliaObject.
  • Bug correction for c.JuliaObject.


  • Make the error in install_dependency not muted.
  • Various performance improvements in julia_call interface functions.
  • Performance improvement for sexp, rcopy and creating of JuliaObject.
  • Performance improvement in display systems.
  • Have a julia$simple_call interface which is a simple and more performant "equivalent" of the julia_call interface.
  • Various small bug fixes.

JuliaCall 0.14.0

  • Seventh release on CRAN.


  • Use more robust way to locate libjulia, fix #29 and #57.
  • A simple interface to get access to JuliaCall from Rcpp.
  • Bug correction for as.vector.JuliaObject.
  • Bug correction for as.double.JuliaObject.
  • Add error message that old version julia is not supported.
  • Add error message when libjulia located is not a valid file.


  • Various small bug fixes.
  • JuliaObject supports multiple index.
  • Implementation of mean, determinant and solve generics for JuliaObject.
  • Implementation of c and t generics for JuliaObject.
  • Implementation of aperm, dim<- and as.vector generics for JuliaObject.


  • Important bug fixes.
  • Reduce the number of messages from julia_setup(verbose = TRUE).
  • Add need_return argument to julia_eval, now there is a possibility to return the result as an JuliaObject, which is convenient for many use cases requiring an R object corresponding to a julia object.
  • Bug fixing for unary operators on JuliaObject.
  • Implement rep.JuliaObject.
  • Important bug fix for assign of JuliaObject.
  • New experimental assign! to match behavior for assign in R and use it for JuliaObject.
  • Experimental JuliaPlain idea to alleviate the problem that R dispatches only on the first argument, make ifelse possible to work for JuliaObject.
  • Fix display issue #54 when using JuliaCall from julia and RCall.jl.
  • Speed up the loading a little.
  • Array related methods dim.JuliaObject, is.array.JuliaObject and is.matrix.JuliaObject.

JuliaCall 0.13.0

  • Sixth release on CRAN.


  • Add autowrap, which can generates automatic wrappers for julia types.
  • Fix bugs in passing arguments in julia_docall and julia_call.


  • Fix the issue in displaying JuliaObject, especially in Rmd documents. Fix #43.
  • x$name could be used to get access to field(x, name) for JuliaObject.


  • Speed up RCall checking.
  • Use some tricks to get around julia issue #14577.

JuliaCall 0.12.2

  • Fifth release on CRAN.


  • Clearer documentation for JULIA_HOME.
  • More helpful error message for julia_setup()
  • Bug fix for julia engine in Rnw files.
  • Bug fix for JuliaCall in rtichoke.

JuliaCall 0.12.1

  • Fourth release on CRAN.


  • JuliaCall requires Julia 0.6 as Julia 0.5 is now officially unmaintained.
  • Don't use inline to compile functions at julia_setup() any more, accelerate the startup time.
  • Load juliarc in julia_setup.
  • Fix the bug that julia_setup() fails to correctly load libjulia.dll if JULIA_HOME is not in path on windows.
  • Get JULIA_HOME from environment variable.

JuliaCall 0.11.1

  • Third release on CRAN.


  • Remove deprecated julia_eval_string.
  • Improve JuliaCall RMarkdown engine. The display system should work for all kinds of documents that rmarkdown supports.
  • Should use older version of RCall with older version of R.

JuliaCall -

  • Important bug fix in JuliaObject, for more detail, see github issue #15, issue #12 and #13 are related.
  • Implement generics for JuliaObject, and fix many small bugs.
  • Julia tuple converts to R S3 class of JuliaTuple based on list.
  • Add fields, field and field<- function for JuliaObjects.
  • Use R6 for the implementation of JuliaObject. It's lightweight, faster, and safer.


  • Performance improvements for dot notation function call.

JuliaCall 0.9.3

  • Second release on CRAN.


  • New Julia display system plotsViewer(), which integrates better into R.
  • Fits several bugs in JuliaCall, like removing using of depreated function.
  • Improve display systems of RMarkdown and Jupyter R Notebook.


  • Improve JuliaObject, same Julia object could enter julia_object_dict only once. And the display of JuliaObject becomes better. Also every common types of Julia Object could be wrapped by JuliaObject.
  • The users could now choose to have JuliaObject type return value instead of R Object.
  • Dot notation in julia is now accepted through the julia_call interface.
  • julia_eval_string is deprecated in favor of julia_eval.


  • Try to convert julia tuple.
  • Add JuliaObject, which serves as a proxy in R for julia object, which is the automatic conversion target when other choices are not possible.
  • julia_setup() doesn't need to be called first unless you want to force julia to restart or you need to set the julia path.


  • julia.do_call and julia_call now accept keyword arguments.
  • JuliaCall works in Jupyter R notebook.
  • JuliaCall works in R Markdown. The display system currently only work for html document. When there is no return from julia function and there is a need to display, a div with class=‘JuliaDisplay’ will be inserted into the html document with the corresponding content.
  • Julia engine in R Markdown through JuliaCall.


  • Have a basic julia display system, now the plot functionality in Julia works (mostly).
  • JuliaCall is more consistent with julia.


  • Added a file to track changes to the package.
  • Add helpful error messages in libjulia DLL load and compilation.
  • Add julia_assign which can assign a value to a name in julia with automatic type conversion.
  • Give the option to set path for julia.
  • Deprecate julia_check.
  • julia_console. Now there is a fully functional julia repl in R terminal, and a usable julia console when you use IDE for R.
  • In julia_setup, there is an option whether or not to use RCall.jl, RCall's R REPL mode and rgui will be set correctly.

JuliaCall 0.7.3

  • First release on CRAN.
  • julia_setup for initial setup of JuliaCall.
  • julia_eval_string, julia_command for executing commands in julia.
  • and julia_call for calling functions in julia.
  • Functions to deal with julia packages.
  • Helper functions like julia_help.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.16.2 by Changcheng Li, 19 days ago

Report a bug at

Browse source code at

Authors: Changcheng Li [aut, cre] , Randy Lai [ctb] , Dmitri Grominski [ctb] , Nagi Teramo [ctb]

Documentation:   PDF Manual  

Task views: Numerical Mathematics

MIT + file LICENSE license

Imports utils, Rcpp

Suggests testthat, knitr, rmarkdown

Linking to Rcpp

System requirements: Julia >= 0.6.0, RCall.jl

Imported by convexjlr, diffeqr.

Suggested by knitr.

See at CRAN