Key Points

Introduction to R and RStudio


  • R is a programming language and software used to run commands in that language
  • RStudio is software to make it easier to write and run code in R
  • Use R Projects to keep your work organized and self-contained
  • Write your code in scripts for reproducibility and portability

Introduction to R Packages, Markdown and Notebooks


  • Use install.packages() to install packages (libraries)
  • Use library() to load packages
  • R Markdown is a useful language for creating reproducible documents combining text and executable R code
  • Specify chunk options to control formatting of the output document

Starting with Data


  • Use read_csv to read tabular data in R.
  • Use factors to represent categorical data in R.

Manipulating Data with dplyr and tidyr


  • Use the dplyr package to manipulate dataframes.
  • Use select() to choose variables from a dataframe.
  • Use filter() to choose data based on values.
  • Use group_by() and summarize() to work with subsets of data.
  • Use mutate() to create new variables.
  • Use the tidyr package to change the layout of data frames.
  • Use pivot_wider() to go from long to wide format.
  • Use pivot_longer() to go from wide to long format.

Quantitative Data Analysis in R