I just started to learn Julia
in Quarto
but when I run the following code in a Julia chunk in Quarto:
---
title: "Julia in Quarto"
editor: visual
format: html
---
```{julia}
# generating vectors
# x-axis
x = 1:10
# y-axis
y = rand(10)
# simple plotting
plot(x, y)
```
It returns:
Error in loadNamespace(x) : there is no package called ‘JuliaCall’
The error still appears even when adding:
using Pkg
Pkg.add("JuliaCall")
To the code chunk. Does anyone knows how to run the following Julia code in Quarto?
Please note: I use Rstudio
JuliaCall
is an R package. Quarto executes Julia code using the IJulia
Jupyter kernel. To use it, specify jupyter: julia_version
in the YAML header. A Quarto installation guide is available.
To render Quarto documents that contain Julia chunks
]
.Add IJulia
using IJulia
notebook()
. Use Ctrl+c or quitting julia to stop the Jupyter kernel.If you don't have Jupyter installed at this point, this will be installed, refer to the above guide for details. This may take a while and prompt some input.
Now you should be able to render a document via the Quarto Cli from a shell and1 RStudio. For example, the following example.qmd should render and print a matrix.
---
title: "Bla"
jupyter: julia-1.8
---
```{julia}
[1 2 3]
```
This may a slow. Refer to the above guide on installing Revise.jl
and using Jupyter Cache to speed things up. I personally experience speedup in using VSCode + Quarto extension over RStudio.
If not, the following allows R users to run Julia code from within R and RStudio,
install.packages("JuliaCall")
JuliaCall::julia_setup()
This takes care of some PATH variable and comes with the installJulia
optional argument.