See also: https://gist.github.com/skranz/9681509
replyr_group_by(.data, colnames)
.data | data.frame |
---|---|
colnames | character vector of column names to group by. |
.data grouped by columns named in colnames
d <- data.frame(Sepal_Length= c(5.8,5.7), Sepal_Width= c(4.0,4.4), Species= 'setosa') replyr_group_by(d, 'Species')#> # A tibble: 2 x 3 #> # Groups: Species [1] #> Sepal_Length Sepal_Width Species #> <dbl> <dbl> <chr> #> 1 5.8 4 setosa #> 2 5.7 4.4 setosa