Examples for 'srvyr::survey_tally'


Count/tally survey weighted observations by group

Aliases: survey_tally survey_count

Keywords:

### ** Examples

library(survey)
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: 'survey'
The following object is masked from 'package:graphics':

    dotchart
data(api)

dstrata <- apistrat %>%
  as_survey_design(strata = stype, weights = pw)

dstrata %>%
  group_by(awards) %>%
  survey_tally()
# A tibble: 2 × 3
  awards     n  n_se
  <fct>  <dbl> <dbl>
1 No     2236.  216.
2 Yes    3958.  216.
dstrata %>%
  survey_count(awards)
# A tibble: 2 × 3
  awards     n  n_se
  <fct>  <dbl> <dbl>
1 No     2236.  216.
2 Yes    3958.  216.

[Package srvyr version 1.1.1 Index]