Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 1.48 KB

scimax-jupyter-r.org

File metadata and controls

61 lines (45 loc) · 1.48 KB

Jupyter and R

On a Mac, you can install R like this.

brew install R

In an R terminal, run this to setup the kernel

> install.packages(‘IRkernel’) > IRkernel::installspec()

Here is a video of this in action.

I don’t use R a lot, so you may need settings like this to get it working.

https://developers.refinitiv.com/en/article-catalog/article/setup-jupyter-notebook-r

;;
(setq org-babel-default-header-args:jupyter-R
      '((:results . "value")
	(:session . "jupyter-R")
	(:kernel . "ir")
	(:pandoc . "t")
	(:exports . "both")
	(:cache .   "no")
	(:noweb . "no")
	(:hlines . "no")
	(:tangle . "no")
	(:eval . "never-export")))

(require 'jupyter)
(require 'ob-jupyter)

(use-package ess)
(add-to-list 'org-src-lang-modes '("jupyter-R" . R))
(add-to-list 'org-babel-load-languages '(jupyter . t) t)
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)

Then, in principle, org-babel blocks like this should work.

x <- seq(-pi, pi, 0.1)
plot(x, sin(x))