Setup
R and RStudio
R is a free programming language for data analysis. RStudio is a free program that makes R easier to use. You need to install both, and R must be installed first.
For installation steps, see this R & RStudio lesson.
Creating a project in RStudio
To create a project, click on Project in the top-right corner, then select New Project. You can create a new project in a new folder or an existing folder.
To create a new project in a new folder, select New Directory. Then click New Project, enter the name of the new folder under Directory Name and select where to save this new folder by clicking Browse and choosing a destination. Finally, click Create Project.
To create a new project in an existing folder, select Existing Directory. Click Browse and select the existing folder. Finally, click Create Project.
Packages
Use install.packages() to install the required packages. You only need to run this line of code once.
# Install packages
install.packages(c("dplyr", "tidyr", "glue"))
Use library() to load each individual package. You need to load each required package every time you open RStudio.
# Load packages
library(dplyr) # To manipulate and combine data
library(tidyr) # To reshape data
library(glue) # To print variables easily
Technique: Converting data formats, Cleaning data, Extracting data
Tools: R
Data Format: Statistics