This repository is a collection of tutorials for learning R using data sets from bioinformatics, biology, and chemistry.
Download the repository
To download the tutorials in this repository, click the green bar on the right, and then click Download ZIP.
For Windows users, you will have to unzip/extract the files inside the ZIP file you just downloaded before moving on. To do so, go to the directory which has the ZIP file in it, right click it and click Extract all, then you can pick a folder you prefer to store the extracted files.
In what follows, we will have different instructions for different users, i.e. Windows, Scholar Cluster and ITAP Lab computers in Purdue University, please follow the instructions correspond to your machine type.
For Windows Users
Table of Contents
You can download R from CRAN
Click Download R for Windows,
Since this is the first time you install R, choose the base version.
Then click the link to download the R installer.
Run the .exe file you just downloaded, and don't change the default settings. Once the installing procedure is done, R should be installed in your computer.
RStudio is probably the best IDE to work with R and it's free! The R tutorials provided in this repository will run on RStudio.
To download RStudio, go to the RStudio official site, then scroll down to the All Installers section, and download the Windows installer.
Again, run the .exe file you just downloaded, and don't change the default settings.
Once you finished installing RStudio, open it and click the file button on the top left, then click New File, R Markdown.
If this is your first time working with R Markdown files, you will see a prompt like this,
Click "Yes" to install all the required packages so you can create and use R Markdown files.
To be able to run the tutorials, you need to install the package
learnr. There are two easy ways to install a package in RStudio,
You can type
install.packages("package name") in the console window and hit enter on your keyboard. For example, to install the
Or you can install a package by clicking the
Packages button on the right, then click
install, and in the prompted window, type in the name of the package you want to install, then click
install. For example, to install the
Run a Tutorial
To run a tutorial, open RStudio, click the file button on the top left, then click Open File. Navigate to the folder which has all the tutorials, click the tutorial folder you want to open, then click the file with extension
.rmd (R Markdown file). For instance, to open the first tutorial,
Once you opened the R Markdown file, you RStudio should look similar to this,
Some tutorials require additional packages, to see the required packages for each tutorial, you can visit the corresponding GitHub page. For example, the only required packages for tutorial 1 is
You can install multiple packages at once. Tutorial 4 requires three additional packages:
RColorBrewer. To install all of them, in your console window, type in
install.packages(c('tidyverse', 'magrittr', 'RColorBrewer')).
Once you have installed all the required packages, you can run a tutorial by clicking the
Run Dcoument button located on the top.
If you succeed, you should see a window like this,
If you are a Purdue faculty or student, you have the access to the ITAP computers in campus. R and RStudio are already installed in the ITAP computers, so you don't have to worry about the installation part, instead we will focus on how to set up your ITAP computer so you can run the tutorials.
After this, please follow these steps under Windows section,