Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when quantiles passed to survey_median() #143

Open
gergness opened this issue Apr 5, 2022 · 0 comments
Open

Warn when quantiles passed to survey_median() #143

gergness opened this issue Apr 5, 2022 · 0 comments

Comments

@gergness
Copy link
Owner

gergness commented Apr 5, 2022

Seems like an easy mistake to make, and currently it just silently gives you the median.

library(srvyr)
data(api, package = "survey")

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

dstrata %>%
   summarize(
      x = survey_median(api99, quantiles = 0.2),
      median = survey_median(api99),
      twentith = survey_quantile(api99, quantiles = 0.2)
   )
#> # A tibble: 1 × 6
#>       x  x_se median median_se twentith_q20 twentith_q20_se
#>   <dbl> <dbl>  <dbl>     <dbl>        <dbl>           <dbl>
#> 1   631  17.5    631      17.5          504            10.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant