From the course: Learning the R Tidyverse
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Row-wise groups: rowwise() and c_across() - R Tutorial
From the course: Learning the R Tidyverse
Row-wise groups: rowwise() and c_across()
- [Instructor] We finished looking at how to do column-wise grouping within your data in a tidyverse. It's time to look at row-wise grouping with row-wise and c_across. Let's see how to use these functions and do row-wise grouping in the project 04_07b. In our row-wise script, let's load the tidyverse on line one and we'll read in our dataset exam_data on line three. Let's print that dataset to the console and take a look at it. So what we have is we have some students and we have the exam scores on various different subjects across different year groups. Now, what if we wanted the average result by row, so for each student within each year, instead of across the columns? Well, we need to start with row wise. So we pipe our data into the function rowwise. And when we run this, scroll to the top of the tibble, we can see that our tibble is now row-wise grouped. We're now going to use mutate to create a new column on the far right-hand side of the dataset. So we'll use mutate and our…
Contents
-
-
-
-
-
-
(Locked)
Grouping and summarizing data by column or row2m 22s
-
(Locked)
Cross tabulations with count()3m 21s
-
(Locked)
Column-wise groups: group_by() and mutate()3m 38s
-
(Locked)
Column-wise groups: group_by() and summarize()3m 10s
-
(Locked)
Column-wise groups: group_by() and reframe()3m 8s
-
(Locked)
Column-wise groups: Using the .by argument instead of group_by()2m 40s
-
(Locked)
Row-wise groups: rowwise() and c_across()4m 12s
-
(Locked)
Remember to ungroup()1m 50s
-
(Locked)
Challenge: Find maximum penguin dimension by island1m 3s
-
(Locked)
Solution: Find maximum penguin dimension by island3m 40s
-
(Locked)
-
-
-