Skip to contents

Helper for the create_analysis. It will take all the columns that are character, logical, double or integers.

Usage

create_loa(design, group_var = NULL, sm_separator = ".")

Arguments

design

Survey design object created with srvyr::as_survey or as_survey_design

group_var

The grouping variable as string. If a combination of grouping variable should be used together it should be 1 string character separated with a ",". i.e. c("admin1", "population") and "admin1, population" are different:

  • c("admin1", "population") : will perform the analysis grouping once by admin1, and once by population

  • "admin1, population" : will perform the analysis grouping once by admin1 and admin 2

sm_separator

Separator for choice multiple questions. The default is "."

Value

a list of analysis.

Examples

shorter_df <- analysistools_MSNA_template_data[, c(
  "admin1",
  "expenditure_debt",
  "wash_drinkingwatersource"
)]

create_loa(
  design = srvyr::as_survey(shorter_df),
  group_var = "admin1"
)
#> Joining with `by = join_by(type)`
#>     analysis_type             analysis_var group_var level
#> 1 prop_select_one                   admin1      <NA>  0.95
#> 2            mean         expenditure_debt      <NA>  0.95
#> 3          median         expenditure_debt      <NA>  0.95
#> 4 prop_select_one wash_drinkingwatersource      <NA>  0.95
#> 5            mean         expenditure_debt    admin1  0.95
#> 6          median         expenditure_debt    admin1  0.95
#> 7 prop_select_one wash_drinkingwatersource    admin1  0.95