Monday, 5 September 2016

Running R on Notebooks

Sometime you have a particular task which requires both R and Python.
Running them, on different IDE's becomes tedious.

So, today lets learn to run R on jupyter notebook. There are two options to achieve this

1. Simple but not a Data Scientist way
a. Install minconda from Anaconda, from http://conda.pydata.org/miniconda.html
    NOTE: - You need to have Python3 running on your system for this.



2. A more managed way to run R on notebook

a. Update your ipython notebook
> conda update ipython notebook

b. Install R Kernel
> conda install -c r ipython-notebook r-irkernel
This step will install all the R's Kernel
if you want it to install it with some other packages too than use command 
> conda install -c r r-essentials

The Anaconda team has created an “R Essentials” bundle with the IRKernel and over 80 of the most used R packages for data science, including dplyrshinyggplot2tidyr,caret and nnet.

c. R has now being installed, check it by typing r.

d. You may also be interested in installing other R tools like 'rzmq','repr','IRkernel','IRdisplay'
> install
.packages(c('rzmq','repr','IRkernel','IRdisplay'), repos = 'http://irkernel.github.io/', type = 'source') 

e. Finally type 
> IRkernel::installspec()

f. 
> quit()
Check your Notebook, you have your R enabled.
Enjoy :)

No comments:

Post a Comment