assign_hiAdmin_loAdmin: Assign higher administrative unit data to a lower one

Description Usage Arguments Value Examples

View source: R/aggregation.R

Description

As data is not always available at the required level, it might be needed to assign/input data from a higher administrative unit to a lower one. For instance, if a country has three administrative unit: region, province, and communes, this function can help to bring data available only at the region-level to a province-level data set.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
assign_hiAdmin_loAdmin(
  HiAdmin_df,
  HiAdmin_df_name,
  HiAdmin_name,
  context,
  context_AP,
  WSC_AP,
  LoAdmin_df,
  LoAdmin_name
)

Arguments

HiAdmin_df

data.frame with the higher administrative unit data

HiAdmin_df_name

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

HiAdmin_name

character string with the column name of the higher administrative unit. Must be identical to the relevant column name in LoAdmin_df to allow cross-reference.

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“')

LoAdmin_df

data.frame with the lower administrative unit data. Can be just a list of lower administrative levels.

LoAdmin_name

character string with the column name of the higher administrative unit. Must be identical to the relevant column name in LoAdmin_df to allow cross-reference.

Value

a data.frame with the aggregated data at a lower administrative level

Examples

1
2
3
4
assign_hiAdmin_loAdmin(HiAdmin_df = WSC::bfa_smart_2019_admin1, HiAdmin_name = "admin1",
                       HiAdmin_df_name = "smart_2019_admin1",
                       context = "bfa_2020", context_AP = WSC::context_AP,
                       WSC_AP = WSC::WSC_AP, LoAdmin_df = WSC::bfa_msna_2020, LoAdmin_name = "admin2")

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