score_df_AP: Score dataset according to the Analysis Plan (AP) phases.

Description Usage Arguments Value Examples

View source: R/aggregation.R

Description

This function scores datasets according to the phases documented in the AP under the columns None/Minimal to Catastrophic.

Usage

1
2
3
4
5
6
7
8
9
score_df_AP(
  data = NULL,
  data_name = NULL,
  data_type = NULL,
  agg_level,
  context,
  context_AP,
  WSC_AP
)

Arguments

data

data.frame containing the data to be scored

data_name

character string with the name of the data as is in the data_source_name column of context_AP.

data_type

character string with the type of data source in data. Must be "area" or "hh".

agg_level

character string specifying which column should be used to aggregate the data. This is is typically an administrative unit (e.g. province, region, departement, admin2, etc.)

context

character string identifying the context to be used in the function call. This is to be used if multiple context (geographical or temporal) are being analysed. For instance, if data is used for Burkina Faso in 2020 and 2019, this column can help distinguish the indicators.

context_AP

data.frame with context specific analysis plan (AP) that links the indicators in the WSC AP to the datasets used in the context analysis. See an example [here](https://docs.google.com/spreadsheets/d/1Pv1BBf32faE6J5tryubhVOsQJfGXaDb2t23KWGab52U/edit?usp=sharing) or in WSC::context_AP.

WSC_AP

data.frame with the general WSC analysis plan (AP) than can be found here or as an object in the package (“'WSC::WSC_AP“')

Value

a data.frame containing the phase for each administrative level taken into consideration

Examples

1
2
3
4
5
6
7
8
9
area_df <- score_df_AP(data = WSC::bfa_smart_2019_admin1, data_name = "smart_2019_admin1",
         data_type = "area",
         agg_level = "admin1", context = "bfa_2020", context_AP = WSC::context_AP,
         WSC_AP = WSC::WSC_AP)

hh_df <- score_df_AP(data = WSC::bfa_msna_2020, data_name = "msna_2020",
         data_type = "hh",
         agg_level = "admin1", context = "bfa_2020", context_AP = WSC::context_AP,
         WSC_AP = WSC::WSC_AP)

ElliottMess/WSC documentation built on Jan. 8, 2021, 12:42 a.m.