Count the observations in each group.
Arguments
- x
- ...
Variables to group by, named according to
featureNames
- wt
If NULL (the default), counts the number of rows in each group. If a variable, computes sum(wt) for each group.
- sort
If TRUE, will show the largest groups at the top.
- name
If omitted, it will default to n. If there's already a column called n, it will use nn. If there's a column called n and nn, it'll use nnn, and so on, adding ns until it gets a new name.
Examples
my_flowframe <-
simulate_cytometry_data()$flowframe |>
dplyr::mutate(
random_group =
sample(
c("a", "b"),
size = nrow(simulate_cytometry_data()$flowframe),
replace = TRUE
)
)
my_flowframe |>
dplyr::count(random_group)
#> # A tibble: 2 × 2
#> random_group n
#> <dbl> <int>
#> 1 1 40
#> 2 2 60