Calculates the interquartile range from complex survey data.
A wrapper for taking differences of svyquantile
at 0.25 and 0.75 quantiles,
and meant to be called from within srvyr::summarise.
Examples
library(survey)
library(srvyr)
#>
#> Attaching package: ‘srvyr’
#> The following object is masked from ‘package:stats’:
#>
#> filter
data(api)
dstrata <- apistrat %>%
as_survey(strata = stype, weights = pw)
dstrata %>%
summarise(api99_iqr = survey_IQR(api99))
#> # A tibble: 1 × 1
#> api99_iqr
#> <dbl>
#> 1 202