Note: tally() treats groups like summarize(.groups = "drop_last") and not like count() (which either uses .groups = "drop" or .groups = "keep" depending on how they're passed).
pacman::p_load(dplyr)
df <- tibble(x = c("a", "a", "b"), y = c("a", "a", "b"))
df %>%
group_by(x, y) %>%
tally()
#> # A tibble: 2 × 3
#> # Groups: x [2]
#> x y n
#> <chr> <chr> <int>
#> 1 a a 2
#> 2 b b 1
df %>%
group_by(x, y) %>%
count()
#> # A tibble: 2 × 3
#> # Groups: x, y [2]
#> x y n
#> <chr> <chr> <int>
#> 1 a a 2
#> 2 b b 1
Note:
tally()
treats groups likesummarize(.groups = "drop_last")
and not likecount()
(which either uses.groups = "drop"
or.groups = "keep"
depending on how they're passed).