group_rows {dplyr} | R Documentation |
Grouping data
group_rows(.data) group_data(.data)
.data |
a tibble |
group_data()
return a tibble with one row per group. The last column, always called .rows
is a list of integer vectors indicating the rows for each group.
If .data
is a grouped data frame the first columns are the grouping variables.
group_rows()
just returns the list of indices.
Other grouping functions: group_by_all
,
group_by
, group_indices
,
group_keys
, group_map
,
group_nest
, group_size
,
group_trim
, groups
df <- tibble(x = c(1,1,2,2)) # one row group_data(df) group_rows(df) # 2 rows, one for each group group_by(df,x) %>% group_data() group_by(df,x) %>% group_rows()