From the course: Learning the R Tidyverse

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

Grouping and summarizing data by column or row

Grouping and summarizing data by column or row - R Tutorial

From the course: Learning the R Tidyverse

Grouping and summarizing data by column or row

- [Instructor] Grouping and summarizing data are closely related activities, particularly in a tidyverse. We'll get extremely different summaries and groupings when we switch between grouping our data by row or column. To compare the differences between column and row grouping, I'm going to use two data sets in this course, the "Star Wars" dataset and a tibble containing exam results for several students. Our "Star Wars" data is in long format. Any kind of summary that we'd want to make would be column-wise. For instance, we might want to count the total number of characters by home world, or we might want the height of the tallest character from each home world, or potentially from each combination of home world and species. Column-wise grouping is the most common type of grouping that you'll use with your data, and it's for default. But sometimes we care about row-wise grouping. Our exams data has been stored in a slightly wide format, which can be really useful. By grouping the…

Contents