-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
If you're grouping by an interact variable, it's not possible to avoid dropping missing levels.
library(srvyr)
data(api, package = "survey")
dstrata <- apistrat %>%
as_survey_design(strata = stype, weights = pw)
dstrata %>%
filter(stype == "E") %>%
group_by(stype, .drop = FALSE) %>%
summarize(n = survey_total())
#> # A tibble: 3 × 3
#> stype n n_se
#> <fct> <dbl> <dbl>
#> 1 E 4421. 0
#> 2 H 0 0
#> 3 M 0 0
dstrata %>%
filter(stype == "E") %>%
group_by(interact(stype), .drop = FALSE) %>%
summarize(n = survey_total())
#> # A tibble: 1 × 3
#> stype n n_se
#> <fct> <dbl> <dbl>
#> 1 E 4421. 0Created on 2021-11-07 by the reprex package (v2.0.1)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels