You need to already have Jupyter installed! If you don't have Python+Jupyter set up, you could use Python Wrangler or you can honestly just go install Anaconda to get started more quickly.
You can find it at https://cloud.r-project.org. It’s hard to figure out where exactly to go, so here are direct links that might be out of date:
- OS X: https://cloud.r-project.org/bin/macosx/R-3.6.3.pkg
- Windows: https://cloud.r-project.org/bin/windows/base/R-3.6.3-win.exe
By running the file you just downloaded
- OS X: Open up Terminal, type
R
, hit enter - Windows: Run R from the start menu
Paste in the code below, hitting enter after each line to run it. This code installs a kernel for R, the thing that allows us to plug R into Jupyter Notebooks.
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()
The first line installs packages, just like pip
does for Python. But it’s a little more annoying: R will ask you which mirror you want to download from (a.k.a. which server). Why can it not just pick one for us? I don’t know. Just pick the first one.
It also will give you some warnings about submodules and stuff when running the last two lines. Don’t worry, it’s probably all fine!
- Start a new Jupyter Notebook server by running
jupyter notebook
from the command line - Click New to make a new notebook and confirm that R is now also an option in the New menu.
- No errors? You’re all set!