Skip to contents

Function to calculate Livelihood Coping Strategy Index (LCSI)

Usage

add_eg_lcsi(
  .dataset,
  lcsi_stress_vars,
  lcsi_crisis_vars,
  lcsi_emergency_vars,
  yes_val = NULL,
  no_val = NULL,
  exhausted_val = NULL,
  not_applicable_val = NULL,
  ignore_NA = FALSE
)

Arguments

.dataset

A dataframe with the ten LCSI variables needed for analysis.

lcsi_stress_vars

A vector of character values that are the column names for the four stress LCSI variables.

lcsi_crisis_vars

A vector of character values that are the column names for the three crisis LCSI variables.

lcsi_emergency_vars

A vector of character values that are the column names for the thre emergency LCSI variables.

yes_val

A character value in the dataset associated with "Yes, used this coping strategy in the last 30 days."

no_val

A character value in the dataset associated with "No, have not used this coping strategy in the last 30 days."

exhausted_val

A character value in the dataset associated with "No, haven't used in the last 30 days because I've exhausted this coping strategy in the last 6 or 12 months."

not_applicable_val

A character value in the dataset associated with "This coping strategy is not applicable for the household.

ignore_NA

Default is FALSE. If set to TRUE, the missing values will be ignored.

Value

Returns a dataframe with added columns for LCSI indicators. - lcsi_x_yes : 1 means one of the of the x strategies was used (*yes_val*) - lcsi_x_exhaust: 1 means one of the x strategies was exhausted and could not be used (*exhausted_val*) - lcsi_x: 1 means one of the x strategies was if either used (*yes_val*) or exhausted (*exhausted_val*) Where x is stress, crisis or emergency - lcsi_cat_yes : the highest category between the lcsi_x_yes - lcsi_cat_exhast: the highest category between the lcsi_x_exhaust - lcsi_cat: the highest category between the lcsi_x

Examples

{
  input_data1 <- data.frame(
stress1 =             c("No", "No", "Exhausted", "Not Applicable", "No"),
stress2 =             c("No", "Yes", "Not Applicable", "No", "No"),
stress3 =             c("Not Applicable", "Not Applicable", "Yes", "No", "No"),
stress4 =             c("Not Applicable", "No", "Yes", "Yes", "No"),
crisis1 =             c("No", "Not Applicable", "Yes", "Exhausted", "No"),
crisis2 =             c("No", "No", "No", "No", "No"),
crisis3 =             c("No", "No", "Yes", "Not Applicable", "No"),
emergency1 =          c("No", "Not Applicable", "Not Applicable", "No", "No"),
emergency2 =          c("No", "Not Applicable", "Yes", "Not Applicable", "No"),
emergency3 =          c("Not Applicable", "No", "Not Applicable", "No", "Exhausted"))

add_eg_lcsi(.dataset = input_data1,
lcsi_stress_vars = c("stress1", "stress2", "stress3", "stress4"),
lcsi_crisis_vars = c("crisis1", "crisis2", "crisis3"),
lcsi_emergency_vars = c("emergency1", "emergency2", "emergency3"),
yes_val = "Yes",
no_val = "No",
exhausted_val = "Exhausted",
not_applicable_val = "Not Applicable")

}
#>          stress1        stress2        stress3        stress4        crisis1
#> 1             No             No Not Applicable Not Applicable             No
#> 2             No            Yes Not Applicable             No Not Applicable
#> 3      Exhausted Not Applicable            Yes            Yes            Yes
#> 4 Not Applicable             No             No            Yes      Exhausted
#> 5             No             No             No             No             No
#>   crisis2        crisis3     emergency1     emergency2     emergency3
#> 1      No             No             No             No Not Applicable
#> 2      No             No Not Applicable Not Applicable             No
#> 3      No            Yes Not Applicable            Yes Not Applicable
#> 4      No Not Applicable             No Not Applicable             No
#> 5      No             No             No             No      Exhausted
#>     lcsi_stress1   lcsi_stress2   lcsi_stress3   lcsi_stress4   lcsi_crisis1
#> 1 no_had_no_need no_had_no_need not_applicable not_applicable no_had_no_need
#> 2 no_had_no_need            yes not_applicable no_had_no_need not_applicable
#> 3   no_exhausted not_applicable            yes            yes            yes
#> 4 not_applicable no_had_no_need no_had_no_need            yes   no_exhausted
#> 5 no_had_no_need no_had_no_need no_had_no_need no_had_no_need no_had_no_need
#>     lcsi_crisis2   lcsi_crisis3 lcsi_emergency1 lcsi_emergency2 lcsi_emergency3
#> 1 no_had_no_need no_had_no_need  no_had_no_need  no_had_no_need  not_applicable
#> 2 no_had_no_need no_had_no_need  not_applicable  not_applicable  no_had_no_need
#> 3 no_had_no_need            yes  not_applicable             yes  not_applicable
#> 4 no_had_no_need not_applicable  no_had_no_need  not_applicable  no_had_no_need
#> 5 no_had_no_need no_had_no_need  no_had_no_need  no_had_no_need    no_exhausted
#>   lcsi_stress_yes lcsi_stress_exhaust lcsi_stress lcsi_crisis_yes
#> 1               0                   0           0               0
#> 2               1                   0           1               0
#> 3               1                   1           1               1
#> 4               1                   0           1               0
#> 5               0                   0           0               0
#>   lcsi_crisis_exhaust lcsi_crisis lcsi_emergency_yes lcsi_emergency_exhaust
#> 1                   0           0                  0                      0
#> 2                   0           0                  0                      0
#> 3                   0           1                  1                      0
#> 4                   1           1                  0                      0
#> 5                   0           0                  0                      1
#>   lcsi_emergency lcsi_cat_yes lcsi_cat_exhaust  lcsi_cat
#> 1              0         None             None      None
#> 2              0       Stress             None    Stress
#> 3              1    Emergency           Stress Emergency
#> 4              0       Stress           Crisis    Crisis
#> 5              1         None        Emergency Emergency