Combine all respondents from a cohort set into a single cohort
Source:R/combine_cohorts.R
combine_cohorts.RdCombine all respondents from a cohort set into a single cohort
Examples
# Create a cohort set by demographic variables
demo_cohorts <- example_data |>
create_cohort_set(
id_col = response_id,
grp_cols = c(country, age_group),
weight_col = weight
)
# Combine all cohorts into a single cohort
all_respondents <- combine_cohorts(demo_cohorts)
all_respondents
#> Cohort (N = 500)
#> # A tibble: 500 × 2
#> id weight
#> <chr> <dbl>
#> 1 R0001 1.48
#> 2 R0002 1.13
#> 3 R0003 1.16
#> 4 R0004 1.05
#> 5 R0005 0.639
#> 6 R0006 1.05
#> 7 R0007 0.926
#> 8 R0008 1.22
#> 9 R0009 0.637
#> 10 R0010 0.513
#> # ℹ 490 more rows