function that compute for each respondent the number of selected items, number of applicable items and collapse the three ordered priorities into one select multiple column
add_hesper_main.Rd
The function computes the number of selected items for each respondent, the number of applicable items and collapse the three ordered priorities into one select multiple column
Usage
add_hesper_main(
df,
col_items = c("hesper_drinking_water", "hesper_food", "hesper_shelter",
"hesper_toilet", "hesper_clean", "hesper_clean_women", "hesper_clothes_etc",
"hesper_income_livelihood", "hesper_health", "hesper_health_care_men",
"hesper_health_care_women", "hesper_distress", "hesper_safety", "hesper_education",
"hesper_care", "hesper_support", "hesper_separation", "hesper_displaced",
"hesper_information", "hesper_aid", "hesper_respect", "hesper_movement",
"hesper_time", "hesper_law", "hesper_gbv", "hesper_drug", "hesper_mental_health",
"hesper_care_community", "hesper_other"),
choice_serious = "Serious_problem",
choice_no_serious = "No_serious_problem",
choice_dnk = "Do_not_know",
choice_pnta = "Decline_to_answer",
choice_na = "Not_applicable_to_household",
cols_priority = c("hesper_priority_first", "hesper_priority_second",
"hesper_priority_third"),
col_hesper_top_three = "hesper_top_three_priorities",
col_gender = "gender",
choices_male = "men",
choices_female = "women",
hesper_item_male = NULL,
hesper_item_female = c("hesper_clean_women"),
col_displacement = "pop_group",
choices_displaced = c("refugees", "idp"),
choices_non_displaced = c("hosts"),
hesper_item_displaced = c("hesper_displaced"),
hesper_item_non_displaced = NULL,
add_binaries = TRUE,
add_binaries_subset = TRUE,
subset = TRUE,
add_binaries_undefined = TRUE
)
Arguments
- df
dataframe containing the cleaned data
- col_items
vector of column names containing the hesper items.
- choice_serious
character string representing the choice for serious problem
- choice_no_serious
character string representing the choice for no serious problem
- choice_dnk
character string representing the choice for do not know
- choice_pnta
character string representing the choice for decline to answer
- choice_na
character string representing the choice for not applicable to household
- cols_priority
vector of three column names containing the first, second and third priority hesper items
- col_hesper_top_three
character string representing the column name containing the three ordered priorities
- col_gender
character string representing the column name containing the respondent's gender
- choices_male
character string representing the choice corresponding to male respondent gender
- choices_female
character string representing the choice corresponding to female respondent gender
- hesper_item_male
vector of two choice names corresponding to the hesper items specific for male respondent
- hesper_item_female
vector of two choice names corresponding to the hesper items specific for female respodent
- col_displacement
character string representing the column name containing the respondent's displacement status
- choices_displaced
character string representing the choice corresponding to displaced respondent
- choices_non_displaced
character string representing the choice corresponding to not displaced respondent
- hesper_item_displaced
vector of two choices name coresponding to the hesper items specific for displaced respondent
- hesper_item_non_displaced
vector of two choices name coresponding to the hesper items specific for not displaced respondent
- add_binaries
logical value indicating whether to add binary variables for each hesper item
- add_binaries_subset
logical value indicating whether to add binary variables for each hesper item that are applicable to only a subset of the population
- subset
logical value indicating whether to add binary subset variables for all top three priority child columns that are applicable to only a subset of the population
- add_binaries_undefined
logical value indicating whether to add binary variables for each hesper item that are applicable to only a subset of the population