Description Usage Arguments Examples
group_data()
returns a data frame that defines the grouping structure.
The columns give the values of the grouping variables. The last column,
always called .rows
, is a list of integer vectors that gives the
location of the rows in each group. You can retrieve just the grouping
data with group_keys()
, and just the locations with group_rows()
.
group_indices()
returns an integer vector the same length as .data
that gives the group that each row belongs to (cf. group_rows()
which
returns the rows which each group contains). group_indices()
with no
argument is deprecated, superseded by cur_group_id()
.
group_vars()
gives names of grouping variables as character vector;
groups()
gives the names as a list of symbols.
group_size()
gives the size of each group, and n_groups()
gives the
total number of groups.
See context for equivalent functions that return values for the current group.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | group_data(.data)
group_keys(.tbl, ...)
group_rows(.data)
group_indices(.data, ...)
group_vars(x)
groups(x)
group_size(x)
n_groups(x)
|
.data, .tbl, x |
A data frame or extension (like a tibble or grouped tibble). |
... |
Use of |
1 2 3 4 5 6 7 8 9 10 11 | df <- tibble(x = c(1,1,2,2))
group_vars(df)
group_rows(df)
group_data(df)
group_indices(df)
gf <- group_by(df, x)
group_vars(gf)
group_rows(gf)
group_data(gf)
group_indices(gf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.