How to use your system's default R in Anaconda or Jupyter Notebooks

When using Jupyter Notebooks I like to use the version of R that I use by default in RStudio and not Anconda R. To enable this I do the following:

  1. DO NOT install Anaconda R (assuming you have installed Anaconda)
  2. Using R in your terminal – on linux it is ctrl + alt + t simply type R on the command line
  3. Once in R in your terminal (not in RStudio), install IRkernel package by typing install.packages("IRkernel") and enter
  4. After IRkernel is installed enter the command: IRkernel::installspec()

This should do the trick. Now open Jupyter Notebook or Lab and you should be able to use your default R kernel.

If you are on Windows you have to follow slightly different steps, I’ve tried to lay them down below (note I’ve only tried it on Windows 10):

  1. Get the path to your Window’s R. Usually it is in C:\Program Files\R\R-3.6.0\bin
  2. Now go to Anaconda Prompt (you should have this if you installed Anaconda3). Just search for it on your Start Menu
  3. Navigate to your R path cd C:\Program Files\R\R-3.6.0\bin or at least mine is
  4. Start R in this shell by typing R.exe and hitting enter
  5. Now install IRkernel package as you would do normally - install.packages("IRkernel")
  6. Once installed enter the command: IRkernel::installspec()

That’s it. That should do the trick. Now fire up your Jupyter Notebook or Lab and you should be able to use your default system R kernel.