Skip to contents

This vignette emphasizes how to add indicators for the “main” dataset at the household-level. The package provides functins to add, recode, and prepare the usual humanitarian composite indicators as well as the ones that are specific to the MSNA analytical framework.

main <- dummy_raw_data$main |> as_tibble()
loop <- dummy_raw_data$roster |> as_tibble()

Recategorize demographic variables

Head of household - final values

# Recategorize the head of household variable
main <- add_hoh_final(main)

# Print results
#main |> select(resp_gender, resp_age, resp_hoh_yn, hoh_gender, hoh_age) |> drop_na()

Age variables

# Cateogize age of the respondent
main <- add_age_cat(main, "resp_age")
main <- add_age_18_cat(main, "resp_age")

# Do the same for the individuals
loop <- add_age_cat(loop, "ind_age")
loop <- add_age_18_cat(loop, "ind_age")

# Print results for the loop
#roster |> select(ind_age, ind_age_cat, ind_age_18_cat, ind_age_18_cat_d)

Adding school-aged children count

# Add school-aged children count to the loop
loop <- add_loop_age_dummy(loop, "ind_age", 5, 18)
main <- add_loop_age_dummy_to_main(main, loop, "ind_age_5_18")
# main |> select(ind_age_5_18_n)

# Add school_aged_female children count to the loop
loop <- add_loop_age_gender_dummy(loop, "ind_age", 5, 18, "ind_gender", "female")
main <- add_loop_age_dummy_to_main(main, loop, "ind_age_female_5_18")
# main |> select(ind_age_female_5_18)