Week 4

mutate(), case_when(), summarize(), group_by(), across(), more ggplot2
Published

January 30, 2025

Modified

February 6, 2025

Topics

  • Learn and apply mutate() to change the data type of a variable
  • Apply mutate() to calculate a new variable based on other variables in a data.frame.
  • Apply case_when in a mutate() statement to make a continuous variable categorical
  • Learn how to mutate() across() multiple columns at once.
  • Learn how to summarize() data with group_by() to summarize within categories
  • Learn to facet and change scales/palettes of ggplots.

Announcements

  • Class materials for BSTA 526 will be provided in the shared Dropbox folder BSTA_526_W25_class_materials_public.
  • For today’s class, make sure to download to your computer the folder called part_04, and then open RStudio by double-clicking on the file called part_04.Rproj.
  • If you have not already done so, please join the BSTA 526 Slack channel and introduce yourself by posting in the #random channel.

Class materials

Post-class survey

Homework

  • See Dropbox folder for homework assignment.
  • HW 4 due on 2/6.

Recording

  • In-class recording links are on Sakai. Navigate to Course Materials -> Schedule with links to in-class recordings. Note that the password to the recordings is at the top of the page.