R: Configure Jupyter to work with R on a Mac

The vanilla installation of Jupyter comes with Python pre-installed, but I want to work with R. Here's how.

Step 0 - Install Jupyter

Install Jupyter notebook on a Mac using Homebrew.

Step 1 - Configuring Jupyter for R

Open up Utilities > Terminal and install a few more R-related packages using Homebrew.

brew install libgit2

Open up R within Terminal.

r

Install these R libraries. Take note how you can download multiple libraries at once.

install.packages(c(
'repr',
'IRdisplay',
'evaluate',
'crayon',
'pbdZMQ',
'devtools',
'uuid',
'digest',
'git2r'
), dependencies = TRUE)

Time to install the R package. devtools::install_github allows you to install packages from Github.

devtools::install_github('IRkernel/IRkernel')

Step 2 - Make R visible to Jupyter

Install the Interactive R kernel system-wide.

IRkernel::installspec(user = FALSE)

Step 3 - Create a new File

Visit:

http://localhost:8889/notebooks

You should now be able to see R within Jupyter.


Resources