This function groups a data.frame
according to values of one column.
See also
Other data.frame helpers:
delete_columns_data.frame()
,
round_data.frame()
Examples
df <- data.frame("label" = c("A", "B"), "number" = 1:10)
group_data.frame(df = df, by = "label")
#> $A
#> label number
#> 1 A 1
#> 3 A 3
#> 5 A 5
#> 7 A 7
#> 9 A 9
#>
#> $B
#> label number
#> 2 B 2
#> 4 B 4
#> 6 B 6
#> 8 B 8
#> 10 B 10
#>
group_data.frame(df = df, by = "label", keep_by = FALSE)
#> $A
#> number
#> 1 1
#> 3 3
#> 5 5
#> 7 7
#> 9 9
#>
#> $B
#> number
#> 2 2
#> 4 4
#> 6 6
#> 8 8
#> 10 10
#>