Group by one or more variables

# S3 method for FDF
ungroup(x, ...)

ungroup(x, ...)

# S3 method for FDF
group_by(.data, ..., add = FALSE)

group_by(.data, ..., add = FALSE)

Arguments

x

A FDF.

...

Not used.

.data

A FDF.

add

When add = FALSE, the default, group_by() will override existing groups. To add to the existing groups, use add = TRUE.

Examples

(test <- FDF(datasets::iris))
#> # A Filebacked Data Frame with 150 rows and 5 columns.
(test2 <- group_by(test, Species))
#> # A grouped Filebacked Data Frame with 150 rows and 5 columns.
test2$groups
#> # A tibble: 3 x 2 #> Species ind_row #> <chr> <list> #> 1 setosa <int [50]> #> 2 versicolor <int [50]> #> 3 virginica <int [50]>
group_by(test, starts_with("Sepal"))$groups
#> # A tibble: 117 x 3 #> Sepal.Length Sepal.Width ind_row #> <dbl> <dbl> <list> #> 1 4.3 3 <int [1]> #> 2 4.4 2.9 <int [1]> #> 3 4.4 3 <int [1]> #> 4 4.4 3.2 <int [1]> #> 5 4.5 2.3 <int [1]> #> 6 4.6 3.1 <int [1]> #> 7 4.6 3.2 <int [1]> #> 8 4.6 3.4 <int [1]> #> 9 4.6 3.6 <int [1]> #> 10 4.7 3.2 <int [2]> #> # ... with 107 more rows
group_by(test2, Sepal.Length, add = TRUE)$groups
#> # A tibble: 57 x 3 #> Species Sepal.Length ind_row #> <chr> <dbl> <list> #> 1 setosa 4.3 <int [1]> #> 2 setosa 4.4 <int [3]> #> 3 setosa 4.5 <int [1]> #> 4 setosa 4.6 <int [4]> #> 5 setosa 4.7 <int [2]> #> 6 setosa 4.8 <int [5]> #> 7 setosa 4.9 <int [4]> #> 8 setosa 5 <int [8]> #> 9 setosa 5.1 <int [8]> #> 10 setosa 5.2 <int [3]> #> # ... with 47 more rows