Skip to contents

Returns a data frame of unique grouping combinations.

Usage

group_labels(data, group_cols, arrange = TRUE)

Arguments

data

A data frame.

group_cols

A character vector of column names to group by.

arrange

TRUE or FALSE. If TRUE, then labels will be arranged in ascending order starting with the last column and finishing with the first column.

Value

data.frame

Examples


#----------------------------------------------------------------------------
# group_levels() examples
#----------------------------------------------------------------------------
group_labels(mtcars, "cyl")
#>   cyl
#> 1   4
#> 2   6
#> 3   8
group_labels(mtcars, c("cyl", "carb"))
#>   cyl carb
#> 1   4    1
#> 2   4    2
#> 3   6    1
#> 4   6    4
#> 5   6    6
#> 6   8    2
#> 7   8    3
#> 8   8    4
#> 9   8    8