Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
57 views

Using The R Programming Language in Jupyter Notebook - Anaconda Documentation

This document provides instructions for installing and running R in a Jupyter Notebook environment. It outlines steps to create an environment with the R package, open a Jupyter Notebook in that environment, and run sample R code to load and plot the iris dataset. The code demonstrates using the dplyr and ggplot2 libraries to read, manipulate, and visualize the data. Additional resources on using R with Anaconda are also referenced.

Uploaded by

Ahmed Mohamed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Using The R Programming Language in Jupyter Notebook - Anaconda Documentation

This document provides instructions for installing and running R in a Jupyter Notebook environment. It outlines steps to create an environment with the R package, open a Jupyter Notebook in that environment, and run sample R code to load and plot the iris dataset. The code demonstrates using the dplyr and ggplot2 libraries to read, manipulate, and visualize the data. Additional resources on using R with Anaconda are also referenced.

Uploaded by

Ahmed Mohamed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

(../../../..

(../../../../)

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:
1. Start Navigator (../../getting-started/#navigator-starting-navigator).

(../../../../_images/rJupyterStep1.png)

2. To install the R language and r-essentials packages, select Environments to create an new
environment. Click Create.

(../../../../_images/rJupyterStep2.png)

Name the environment “r-tutorial”. Next to Packages, select Python 3.7 and R. Select r from the
dropdown menu. Click Create.

 v: latest 
(../../../../_images/rJupyterStep2-1.png)

3. Open the environment with the R package (../../getting-started/#navigator-use-environment) using


the Open with Jupyter Notebook option.

(../../../../_images/rJupyterStep3.png)

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

(../../../../_images/rJupyterStep4.png)

5. We will use dplyr to read and manipulate Fisher’s Iris multivariate data set in this tutorial. Copy and
paste the following code into the first cell:

library(dplyr)
iris

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

7. The iris data table is displayed.

8. Using ggplot, we can create a scatter plot comparing sepal length and width of three iris species.
Click + to open a second cell, then copy and paste the following code into the second cell:

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

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

 v: latest 
(../../../../_images/navigator-tutorial07.png)

For more resources on using R with Anaconda, see Using R language with Anaconda (../../../user-
guide/tasks/using-r-language/).

« Displaying BioPython help text (../biopy-help/)     


Installing and running Pandas » (../pandas/)

Docs Home (../../../../) Anaconda Home More Help & Support


(https://www.anaconda.com/) (https://www.anaconda.com/support)
 2020 Anaconda, Inc. All Rights Reserved. Privacy Policy (https://www.anaconda.com/privacy-policy/)

 v: latest 

You might also like