"A column named n (but not nn or nnn) will be used as weighting variable by default".
So I was wondering, in the following example, how come the last call to tally() doesn't use tb$n as the wt argument? Instead of summing n up it just seems to count the rows again.
library(dplyr)
#> Warning: package 'dplyr' was built under R version 3.5.3
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
tb <- mtcars %>%
group_by(cyl) %>%
tally()
tb
#> # A tibble: 3 x 2
#> cyl n
#> <dbl> <int>
#> 1 4 11
#> 2 6 7
#> 3 8 14
tb %>%
tally()
#> # A tibble: 1 x 1
#> n
#> <int>
#> 1 3
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
tb <- mtcars %>%
group_by(cyl) %>%
tally()
tb
#> # A tibble: 3 x 2
#> cyl n
#> <dbl> <int>
#> 1 4 11
#> 2 6 7
#> 3 8 14
tb %>%
tally()
#> Using `n` as weighting variable
#> # A tibble: 1 x 1
#> n
#> <int>
#> 1 32