19.8 Two or more grouping variables

  • Remember last chapter we used climbers to model success of a climber, grouped by expedition.

  • However there is also peak_name as a possible grouping variable!

expeditions <- climbers %>% 
  group_by(peak_name, expedition_id) %>% 
  summarize(n_climbers = n(),.groups="drop")

head(expeditions,4)
## # A tibble: 4 × 3
##   peak_name  expedition_id n_climbers
##   <fct>      <chr>              <int>
## 1 Ama Dablam AMAD03107              5
## 2 Ama Dablam AMAD03327              6
## 3 Ama Dablam AMAD05338             12
## 4 Ama Dablam AMAD06110              5
  • Dataset includes 2076 individual climbers, grouped together in 200 expeditions, to 46 different peaks