Lecture 18 – Grouping and Pivoting

Data 6, Summer 2021

Run the following cell to load in our full dataset.

Here we'll take a subset of the rows and columns for illustration.

group

Default behavior

Specifying a collect function

How does this work under the hood?

If you want a more concise way of doing the above:

What if we use other collect functions?

Quick Check 1

grouping by multiple columns

pivot

Quick Check 2