Coding Lab: Grouped Data
Ari Anisfeld Summer 2020
1 / 22
Coding Lab: Grouped Data Ari Anisfeld Summer 2020 1 / 22 Grouping - - PowerPoint PPT Presentation
Coding Lab: Grouped Data Ari Anisfeld Summer 2020 1 / 22 Grouping data with dplyr Often you want to repeat the same analysis across different subgroups. We can automate that with group_by() . summarize by group with group_by() + summarize()
1 / 22
2 / 22
3 / 22
4 / 22
5 / 22
6 / 22
Houston Galveston 2000 2005 2010 2015 160000 200000 240000 280000 160000 200000 240000 280000
7 / 22
8 / 22
9 / 22
10 / 22
11 / 22
12 / 22
13 / 22
1lag()’s sibling is lead() which will give you data from the following year. 14 / 22
15 / 22
2R has a variety of related functions see ?ranking 16 / 22
17 / 22
18 / 22
19 / 22
20 / 22
21 / 22
◮ we saw lag() and rank(), but you could get also add
22 / 22