srvyr (version 0.2.1)

unweighted: Calculate the an unweighted summary statistic from a survey

Description

Calculate unweighted summaries from a survey dataset, just as on a normal data.frame with summarise.

Usage

unweighted(x, ...)

Arguments

x

A variable or expression

...

Ignored

Examples

Run this code
library(survey)
data(api)

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

dstrata %>%
  summarise(api99_unw = unweighted(mean(api99)),
            n = unweighted(n()))

dstrata %>%
  group_by(stype) %>%
  summarise(api_diff_unw = unweighted(mean(api00 - api99)))

Run the code above in your browser using DataLab