Summarise a dataframe to a person level
person_summary.Rd
In cases where we have a long data frame (i.e., multiple rows of data per participant) with a flag against each record (e.g., variable x
= "Yes"/"No"), this function will collapse this dataframe to a participant level.
Details
The collapsing is based on the value of flag_category_val
and a grouping variable (participant ID) grouping_var
.
Specifically, records will be collapsed such that:
If any record(s) for a participant is equal to
flag_category_val
, then return "Yes".If all record(s) for a participant are not equal to
flag_category_val
, then return "No".