/IRkernel

R kernel for Jupyter

Primary LanguageJupyter NotebookMIT LicenseMIT

Native R kernel for Jupyter Build Status

For detailed requirements and install instructions see irkernel.github.io

Requirements

Installation

We provide Windows and Mac OS X binary packages of all the needed packages:

install.packages(c('repr', 'IRkernel', 'IRdisplay'),
                 repos = c('http://irkernel.github.io/', getOption('repos')))
IRkernel::installspec()

Per default IRkernel::installspec() will install a kernel with the name “ir” and a display name of “R”. Multiple calls will overwrite the kernel with a kernel spec pointing to the last R interpreter you called that commands from. You can install kernels for multiple versions of R by supplying a name and displayname argument to the installspec() call (You still need to install these packages in all interpreters you want to run as a jupyter kernel!):

# in R 3.2
IRkernel::installspec(name = 'ir32', displayname = 'R 3.2')
# in R 3.1
IRkernel::installspec(name = 'ir31', displayname = 'R 3.1')

Now both R versions are available as an R kernel in the notebook.

If you encounter problems during installation

  1. Have a look at the full installation instructions!
  2. Search the existing open and closed issues.
  3. If you are sure that this is a new problem, file an issue.

Running the notebook

If you have Jupyter installed, you can create a notebook using IRkernel from the dropdown menu.

You can also start other interfaces with an R kernel:

# “ir” is the kernel name installed by the above 'IRkernel::installspec()'
# change if you used a different name!
jupyter qtconsole --kernel=ir
jupyter console --kernel=ir

Run in a Docker container

If you have a Docker daemon running, e.g. reachable on localhost, start a container with:

git clone https://github.com/IRkernel/IRkernel.git
cd IRkernel
docker build -t irkernel .
cd <path to your notebooks>
docker run -itp 8888:8888 -v $(pwd):/notebooks/ irkernel

In your browser open the URL http://localhost:8888/. All notebooks from your session will be saved in the current directory.

On other platforms without docker, this can be started using docker-machine by replacing “localhost” with an IP from docker-machine ip <MACHINE>. With the deprecated boot2docker, this IP will be boot2docker ip.