Chris Mendez in Jupyter, R, For Developers, Data Science

R: Configure Jupyter to work with R on a Mac

The vanilla install of Jupyter will come with Python pre-installed but I want to work with R. Here's how.

Step 0 - Install Jupyter

If you do not have Jupyter installed, this article will help you 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')
)

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

devtools::install_github('IRkernel/IRkernel')

installing-r-within-jupyter

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.

r-within-jupyter


Resources