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
#> # A tibble: 1 x 1 #> .rows #> <list> #> 1 <int [4]>group_rows(df)#> [[1]] #> [1] 1 2 3 4 #>#> # A tibble: 2 x 2 #> x .rows #> <dbl> <list> #> 1 1 <int [2]> #> 2 2 <int [2]>#> [[1]] #> [1] 1 2 #> #> [[2]] #> [1] 3 4 #>