groups: Return grouping variables

Description Usage Arguments See Also Examples

Description

group_vars() returns a character vector; groups() returns a list of symbols.

Usage

1
2
3

Arguments

x

A tbl()

See Also

group_cols() for matching grouping variables in selection contexts.

Other grouping functions: group_by_all, group_by, group_indices, group_keys, group_map, group_nest, group_rows, group_size, group_trim

Examples

1
2
3
df <- tibble(x = 1, y = 2) %>% group_by(x, y)
group_vars(df)
groups(df)

Example output

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

[1] "x" "y"
[[1]]
x

[[2]]
y

dplyr documentation built on July 4, 2019, 5:08 p.m.