Introduction to R

Learning Objectives

  • R syntax: Familiarize the basic syntax and the use of Rstudio.
  • Data types and data structures: Describe frequently-used data types and data structures in R.
  • Data inspection and wrangling: Demonstrate the utilization of functions and indices to inspect and subset data from various data structures.
  • Data visualization: Apply the ggplot2 package to create plots for data visualization.

Installations

  1. R (version 4.4.0 or later)

  2. RStudio

Lessons

  1. Introduction to R and RStudio
  2. R Syntax and Data Structure
  3. Functions and Arguments
  4. Reading in and inspecting data
  5. Custom functions exercises
  6. Data Wrangling: Subsetting Vectors and Factors
  7. Packages and libraries
  8. Data wrangling: data frames, matrices and lists
  9. The %in% operator
  10. Setting up a data frame to plot (+ the map() function)
  11. Data wrangling exercises
  12. Plotting with the ggplot2 package
  13. Using custom functions for consistent plots
  14. Generating a boxplot with ggplot2
  15. Writing to file and exporting plots
  16. Finding help
  17. Tidyverse
  18. Tidyverse and Data visualization exercises

Final Exercises

Building on the basic R knowledge

Resources

Cheatsheets