survey_tally: Count/tally survey weighted observations by group
Description
Analogous to tally and count, calculates the survey weighted
count of observations. survey_tally will call survey_total empty (resulting
in the count of each group) or on wt if it is specified (resulting in the
survey weighted total of wt). survey_count is similar, but calls group_by
before calculating the count and then returns the data to the original groupings.
A tbl_svy object, as created by as_survey and related functions.
wt
(Optional) A variable to weight on (in addition to the survey weights,
which are always used). If left unspecified, tally() will use a variable
named "n" if one exists, but count() will not. Override this behavior by
specifying wt = NULL.
sort
Whether to sort the results (defaults to FALSE)
name
Name of count variable created (defaults to n). If the variable already
exists, will add "n" to the end until it does not.
vartype
What types variation estimates to calculate, passed to
survey_total.
...
Variables to group by, passed to group_by().
.drop
When .drop = TRUE, empty groups are dropped, see group_by
documentation for more details.
Details
If n already exists, tally will use it as the weight, but count
will not.