Skip to contents

Recovers groups decorations for class 'data.frame'. Seeks a sequentially-valued integer attribute with name 'groups' for each column, sorts these, and returns a character vector like group_vars(x).

Usage

# S3 method for class 'data.frame'
decorations_groups(x, ...)

Arguments

x

data.frame

...

ignored

Value

character: names of groups columns

Examples

library(magrittr)
library(dplyr)
Theoph %<>% group_by(Subject, Time)
Theoph %>% group_vars
#> [1] "Subject" "Time"   
Theoph %>% decorations_groups # nothing!
#> character(0)
Theoph %<>% decorate_groups
Theoph %>% decorations_groups # something!
#> [1] "Subject" "Time"   
Theoph %<>% ungroup
Theoph %>% group_vars # gone!
#> character(0)
Theoph %<>% group_by(across(all_of(decorations_groups(.))))
Theoph %>% group_vars # recovered!
#> [1] "Subject" "Time"   
Theoph %<>% group_by_decorations
Theoph %>% group_vars # same
#> [1] "Subject" "Time"   
rm(Theoph)