Ricardo Pietrobon Ricardo Pietrobon - 25 days ago 11
R Question

Is there a way to add Julia, R and python to a single text file like R markdown or a notebook that could be manipulated as a text file?

Stated briefly: I would like to have a text file where I can smoothly switch among R, python and Julia. Of importance, I am looking for a way to run rather than just display code

I know it is possible to add python (and many other languages) to R markdown http://goo.gl/4w8XIb , but not sure I could add Julia. Also possible to use notebooks like Beaker http://beakernotebook.com/ with all three languages (and more) , but my issue with notebooks is that they are not nearly as fast to manipulate compared to what can be done with a text file in an editor environment (sublime, emacs, vim, atom ...). I know very little about notebooks, and the ones I know of are represented as json files, but manipulating a json file to write a report is all but user friendly.

I'm probably missing the obvious, but any other way to do this? thanks

Answer Source

I recently created an R package JuliaCall, and it can be used as julia engine in R Markdown document, see https://non-contradiction.github.io/JuliaCall/articles/JuliaCall_in_RMarkdown.html for an example.

Although JuliaCall is already on CRAN, this new feature is still in the development version on github. If you want to try it, use

devtools::install_github("Non-Contradiction/JuliaCall")

to install JuliaCall.

The feature includes

  1. Multiple julia chunks running by same julia session.
  2. Accessing R variables, functions inside julia code and vice versa.

The current limitation is that it only fully support html output.