Skip to contents

Calculating FEWSNET Food Consumption-Livelihood Coping Matrix

Usage

add_eg_fclcm_phase(
  dataset,
  fc_phase_var = "fc_phase",
  fc_phase_1 = "Phase 1 FC",
  fc_phase_2 = "Phase 2 FC",
  fc_phase_3 = "Phase 3 FC",
  fc_phase_4 = "Phase 4 FC",
  fc_phase_5 = "Phase 5 FC",
  lcs_cat_var = "lcsi_cat",
  lcs_cat_none = "None",
  lcs_cat_stress = "Stress",
  lcs_cat_crisis = "Crisis",
  lcs_cat_emergency = "Emergency",
  fclcm_phase_var = "fclcm_phase"
)

Arguments

dataset

Dataset

fc_phase_var

Column name containing food consumption phase.

fc_phase_1

The name of the value "Phase 1 FC" (by default) in the food consumption phase.

fc_phase_2

The name of the value "Phase 2 FC" (by default) in the food consumption phase.

fc_phase_3

The name of the value "Phase 3 FC" (by default) in the food consumption phase.

fc_phase_4

The name of the value "Phase 4 FC" (by default) in the food consumption phase.

fc_phase_5

The name of the value "Phase 5 FC" (by default) in the food consumption phase.

lcs_cat_var

Column name containing livelihood coping category.

lcs_cat_none

The name of the value "None" (by default) in the livelihood coping category.

lcs_cat_stress

The name of the value "Stress" (by default) in the livelihood coping category.

lcs_cat_crisis

The name of the value "Crisis" (by default) in the livelihood coping category.

lcs_cat_emergency

The name of the value "Emergency" (by default) in the livelihood coping category.

fclcm_phase_var

A character vector which will be the column name for FSLC phase.

Value

Returns a dataframe with a additional column for FCLC phase.

Examples

test_df <- data.frame(
  lcsi_cat = c("None", "Stress"),
  fc_phase = c("Phase 1 FC", "Phase 2 FC")
)
test_df |> add_eg_fclcm_phase()
#> Warning: The following values: Crisis, Emergency are defined as arguments in the function but cannot be found in the dataset
#> Warning: The following fc phases: Phase 3 FC, Phase 4 FC, Phase 5 FC are defined as arguments in the function but cannot be found in the dataset.
#>   lcsi_cat   fc_phase  fclcm_phase
#> 1     None Phase 1 FC Phase 1 FCLC
#> 2   Stress Phase 2 FC Phase 2 FCLC