Embedding R into Jupyter

How to embed R into Jupyter?

  1. Suppose you already have installed R and Anacoda with jupyter

  2. Add the local paths of Anacoda and Python to your system Environment, such as

    C:\Program Files\Python37\Scripts\
    

    and

    C:\ProgramData\Anaconda3\condabin\
    
  3. On the Console of Rgui or Rstudio, type

    install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
    devtools::install_github('IRkernel/IRkernel')
    
  4. Keep typing

    IRkernel::installspec()
    

    or

    IRkernel::installspec(user = FALSE)
    
  5. 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.

  6. Start the Anaconda prompt, not the Windows command prompt or the Anaconda Navigator

  7. Find the local path of the executable file of R, eg: C:\Program Files\R\R-3.5.3\bin.

  8. Type follows on the Anaconda prompt.

    C:\Program Files\R\R-3.5.3\bin
    
  9. Type R to start R on the Anaconda prompt.

    R
    
  10. Then type IRkernel::installspec()

    IRkernel::installspec()
    
  11. Now it should be done, and you can find an R kernel within Jupyter-Notebook.