Exercise 7. group_by example 3
We can actually combine both of these summaries into a single line of code. This is because group_by
permits us to group by more than one variable.
We can use group_by(AgeDecade, Gender)
to group by both age decades and gender.
This exercise is part of the course
Data Science Visualization - Module 2
Exercise instructions
- Create a single summary table for the average and standard deviation of systolic blood pressure using
group_by(AgeDecade, Gender)
.- Note that we no longer have to
filter
! - Your code within
summarize
should remain the same as in the previous exercises.
- Note that we no longer have to
- Note: ignore warnings about implicit NAs. This warning will not prevent your code from running or being graded correctly.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
library(NHANES)
data(NHANES)