===================================================
Using the R programing language in Jupyter Notebook
===================================================

R is a popular programing language for statistics.

To install and run R in a Jupyter Notebook:

#. :ref:`Start Navigator <navigator-starting>`.

#. To install the R language and r-essentials packages, follow the 
   instructions in :ref:`navigator-install-package`.

   NOTE: These packages are available in the MRO channel, which you may 
   need to :ref:`add to your channels list <navigator-add-channel>`.

#. :ref:`Open the environment with the R package <navigator-use-environment>` 
   using the Open with Jupyter Notebook option.

#. To create a new notebook for the R language, in the Jupyter Notebook 
   menu, select New, then select R.

#. Copy and paste the following code into the first cell:

   .. code-block:: python

      library(dplyr)
      iris

#. To run the code, in the menu bar, click Cell then select Run Cells, 
   or use the keyboard shortcut Ctrl-Enter.

#. The iris data table is displayed.

#. To plot the data, click + to open a second cell, then copy and paste 
   the following code into the second cell:

   .. code-block:: python

      library(ggplot2)
      ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) + geom_point(size=3)

#. To run the code, in the menu bar, click Cell then select Run Cells, 
   or use the keyboard shortcut Ctrl-Enter.

   .. figure:: /img/navigator-tutorial07.png

      ..

   |

TIP: For more information and to see the example code, see the 
`Continuum Developer Blog <https://www.continuum.io/blog/developer/jupyter-and-conda-r>`_.
