Embedding R into Jupyter
How to embed R into Jupyter?
- There is a simple way to embed R into Jupyter Notebook.
-
Suppose you already have installed R and Anacoda with jupyter
-
Add the local paths of Anacoda and Python to your system Environment, such as
C:\Program Files\Python37\Scripts\
and
C:\ProgramData\Anaconda3\condabin\
-
On the Console of Rgui or Rstudio, type
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest')) devtools::install_github('IRkernel/IRkernel')
-
Keep typing
IRkernel::installspec()
or
IRkernel::installspec(user = FALSE)
-
Embedding R into Jupyter will be done if it succeeds. If there is an error
"Error in IRkernel::installspec() : jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 127."
or you still cannot find an R kernel within Jupyter-Notebook. There is a simple solution. The following steps are required.
-
Start the Anaconda prompt, not the Windows command prompt or the Anaconda Navigator
-
Find the local path of the executable file of R, eg:
C:\Program Files\R\R-3.5.3\bin
. -
Type follows on the Anaconda prompt.
C:\Program Files\R\R-3.5.3\bin
-
Type R to start R on the Anaconda prompt.
R
-
Then type
IRkernel::installspec()
IRkernel::installspec()
-
Now it should be done, and you can find an R kernel within Jupyter-Notebook.