mutate() and filter() are done within the groups, useful in conjunction with window function like lag() or mean()

summarise() summarises for each group

ungroup() can be used to revert the group_by()

Data

Toy data about patient visits, containing the id of the patients, time of visits, the treatment they receive and a measure of how active the disease is. Just copy-paste the data into an R script and get started with the tasks!