dplyr: data wrangling II

Lecture 7

Dr. Elijah Meyer

NC State University
ST 295 - Spring 2025

2025-01-30

Checklist

– Have you cloned the today’s AE repo?

– Are you keeping up with prepare material?

– Quiz-2 is graded! Quiz-3 comes out today at noon

– Homework-2 will be released early next week

Warm up

Identify which dplyr functions chooses rows or changes columns of an existing data set. Also, define what each function does.

select()

slice()

arrange()

Warm up

  • select() chooses columns to subset

  • slice() provides n number of rows

  • arrange() orders the rows of data frame

geom_bar vs geom_col

Takeaway

“There are two types of bar charts: geom_bar() and geom_col(). geom_bar() makes the height of the bar proportional to the number of cases in each group (or if the weight aesthetic is supplied, the sum of the weights). If you want the heights of the bars to represent values in the data, use geom_col() instead.”

ae-06