Description Usage Arguments Details Examples
set groups
1 | set_groups(df, groups)
|
df |
data frame |
groups |
list of groups to pass to group_by_ |
useful in tandem with 'capture_groups' when concerned about modification of groups by a function, for example when summarizing with dplyr Can easily capture and reset groups to maintain original grouping
1 2 3 4 5 6 7 | ## Not run:
gTheoph <- dplyr::group_by(Theoph, Subject)
grps <- capture_groups(gTheoph) # capture subject
theoph_cmax <- summarize(gTheoph, cmax = max(conc)) # lose Subject grouping
theoph_cmax <- set_groups(theoph_cmax, grps) # resets the original "Subject" grouping
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.