Run Julia from R

First we set up the Julia engine.

library(knitr)
library(runr)
j = proc_julia()
j$start()
knit_engines$set(julia = function(options) {
    knitr:::wrap(j$exec(options$code), options)
})

Test a sequence of numbers:

a = [1:10]
## [1,2,3,4,5,6,7,8,9,10]
a + 9
## [10,11,12,13,14,15,16,17,18,19]

Test a function:

b(x) = x^2 + 2x + 1
## b
b(5)
## 36
x = {"a", "b", "c"}
## {"a","b","c"}

Do not forget to shut it down in the end.

j$stop()