====================================================
Using the R programming 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-navigator>`.

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

#. :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

      ..

   |

For more resources on using R with Anaconda, see :doc:`Using R language with Anaconda 
<../../user-guide/tasks/use-r-language>`.

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