This function adds a new column to the input dataframe that categorizes child separation based on the severity of the reasons provided. It takes into account both the initial yes/no question about child separation and the follow-up question about the reasons for separation.
Usage
add_child_sep_cat(
df,
child_sep = "prot_child_sep",
child_sep_yes = "yes",
child_sep_no = "no",
child_sep_undefined = c("pnta", "dnk"),
child_sep_reason = "prot_child_sep_reason",
child_sep_reason_non_severe = c("left_study"),
child_sep_reason_severe = c("left_employment", "left_married"),
child_sep_reason_very_severe = c("left_armed_groups", "kidnapped", "missing",
"detained", "stayed_in_origin", "separated_displacement"),
child_sep_reason_undefined = c("other", "dnk", "pnta"),
sep = "/"
)
Arguments
- df
A data frame.
- child_sep
Child separation yes/no question.
- child_sep_yes
Value for yes.
- child_sep_no
Value for no.
- child_sep_undefined
Vector of undefined responses.
- child_sep_reason
Follow-up question for the reasons of child separation.
- child_sep_reason_non_severe
Values of non-severe reasons.
- child_sep_reason_severe
Values of severe reasons.
- child_sep_reason_very_severe
Values of very severe reasons.
- child_sep_reason_undefined
Values of undefined reasons.
- sep
Separator for the child_sep_reason columns.
Value
A dataframe with an additional column 'prot_child_sep_cat' containing the categorized child separation reasons:
"none": No child separation
"undefined": Undefined responses or reasons
"at_least_one_very_severe": At least one very severe reason for separation
"at_least_one_severe": At least one severe reason for separation
"at_least_one_non_severe": At least one non-severe reason for separation