JuliaCall in Jupyter R Notebook

Changcheng Li

2017-11-16

For the original notebook, please go to https://nbviewer.jupyter.org/github/Non-Contradiction/JuliaCall/blob/master/example/JuliaCall_in_Jupyter_R_Notebook.ipynb.

Here I generate a markdown file from part of the notebook and include it in this vignette.

library(JuliaCall)
julia_setup()
Julia at location /Applications/Julia-0.6.app/Contents/Resources/julia/bin will be used.
Julia version 0.6.0 found.
Julia initiation...
Finish Julia initiation.
Loading setup script for JuliaCall...
Finish loading setup script for JuliaCall.
julia_console()
It seems that you are not in the terminal. A simple julia console will be started.
Press ESC or CTRL+C to exit.

julia> sqrt(2)
1.4142135623730951
julia> @doc sqrt
sqrt(x)

Return ${x}$. Throws DomainError for negative Real arguments. Use complex negative arguments instead. The prefix operator is equivalent to sqrt.

julia> exit

Exiting julia console.
julia_library("Gadfly")
julia_command("Gadfly.plot(y = [1 2 3])")
-1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 -2 0 2 4 6 -1.0 -0.8 -0.6 -0.4 -0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 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