Skip to contents

Takes the data frames created by status_quo() and gather_change(), returns a key that maps each identifier to their traceable cluster.

Clusters are defined as the least common unit which can be uniquely distinguished at any given point in time from all other adm. units.

Keys can be generated for each type of adm. unit independently or jointly. The use-case for joint harmonization can be the need to include fixed-effects of the top-level administrative unit.

Usage

EtE_changes(df_status, df_change, from , to , jointly = FALSE)

Arguments

df_status

A data object: Panel of status (object of type: data.frame or list)

df_change

A data object: Panel of changes (object of type: data.frame or list)

from

An integer: Start year of panel

to

An integer: End year of panel

jointly

A Boolean: Request of harmonizing the types of adm. units jointly. Default FALSE. Important Note: If jointly == TRUE status and change information have to be supplied as a list. The function is agnostic to the ordering of the elements in the list.

Value

A data.frame object with 4 or 7 (joint harmonization) columns. Allows for a 1:1 mapping of all active identifiers in a year to their cluster.

  • geoID - original numeric identifier

  • name - name of adm. unit

  • cluster_id - cluster identifier the unit is assigned to

  • year - year of the mapping

For joint harmonization the lower level adm. unit is mapped to corresponding

  • Gcluster_id - same-level cluster identifier

  • Ccluster_id - top-level cluster identifier

Examples

# Information on status
stat_mun <- status_quo(type = "kommune", from = 1999, to = 2018)
# Information on changes
chg_mun <- gather_change(type = "kommune", from = 1999, to = 2018)
#> 
#> Information on Number and Type of Changes in Municipality Codes: 
#> 
#> There are a total of 85 in the time period: 1999 - 2018 
#> 
#> These are composed of: 
#> 
#> 	60 One-to-One Changes: 
#> 	25 Mergers 
#> 	0 Splits 
#> 	0 Split-Mergers
#> 

#Generate key
key_mun <- EtE_changes(df_status = stat_mun, df_change = chg_mun, from = 1999, to = 2018 , jointly = FALSE)


# Joint harmonization
# repeat information for BSU:
stat_bsu <- status_quo(type = "grunnkrets", from = 1999, to = 2018)
chg_bsu <- gather_change(type = "grunnkrets", from = 1999, to = 2018)
#> 
#> Information on Number and Type of Changes in Grunnkrets (BSU) Codes: 
#> 
#> There are a total of 2787 in the time period: 1999 - 2018 
#> 
#> These are composed of: 
#> 
#> 	2324 One-to-One Changes: 
#> 	7 Mergers 
#> 	350 Splits 
#> 	53 Split-Mergers
#> 

#combine in list
stat_list <- list(stat_bsu, stat_mun) # function handles the ordering independently
chg_list <- list(chg_mun, chg_bsu)

key_joint <- EtE_changes(df_status = stat_list, df_change = chg_list, from = 1999, to = 2018 , jointly = TRUE)