Introduction to R
Learning Objectives
- R syntax: Understand the different ‘parts of speech’.
- Data types structures in R: Describe the various data types and data structures.
- Data inspection and wrangling: Demonstrate the utilization of functions and indices to inspect and subset data from various data structures.
- Visualizing data: Demonstrate the use of the ggplot2 package to create plots for easy data visualization.
Installations
Download the most recent versions of R and RStudio:
Lessons
Part 1
- Introduction to R and RStudio
- R Syntax and Data Structure
- Functions and Arguments
- Reading in and inspecting data
Part II
- Data Wrangling: Subsetting Vectors and Factors
- Packages and libraries
- Data wrangling: data frames, matrices and lists
- The %in% operator
- Reordering and matching
- Setting up a data frame to plot (+ the
map()
function)
Part III
- Plotting with the ggplot2 package
- Using custom functions for consistent plots
- Generating a boxplot with ggplot2
- Writing to file and exporting plots
- Finding help
- Tidyverse
Building on the basic R knowledge
Resources
Cheatsheets
These materials have been developed by members of the teaching team at the Harvard Chan Bioinformatics Core (HBC). These are open access materials distributed under the terms of the Creative Commons Attribution license (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.