map_old_to_new_state {SMMT}R Documentation

Map municipalities of old state to municipalities of new state

Description

This function maps the Swiss municipalities of an old state to municipalities of a new state.

Usage

map_old_to_new_state(mutations, state_old, state_new)

Arguments

mutations

A tibble containing the municipality mutations inventory (see import_CH_municipality_inventory)

state_old

A Date object vector of length one containing the date of the old state.

state_new

A Date object vector of length one containing the date of the new state.

Details

Approach

  1. Download the Swiss municipality inventory

  2. Import it into R workspace with import_CH_municipality_inventory

  3. Set the old state and the new state (see example)

  4. Get the mapping table with this function

Example Daettwil / Baden

On 1.1.1962 Daettwil (Bfs Nr. 4025) merged with Baden (Bfs Nr. 4021). Let's define

Value

A list with 4 elements:

  1. mapped: A tibble with the mapped municipalities

  2. unmapped: A tibble with the unmapped municipalities

  3. state_old: see above

  4. state_new: see above

Examples


mutations <- structure(list(hist_id = c(11227L, 11240L, 13189L),
district_hist_id = c(10025L, 10025L, 10025L),
kanton_abbr = c("AG", "AG", "AG"),
bfs_nr = c(4025L, 4021L, 4021L),
name = c("Daettwil", "Baden", "Baden"),
admission_nr = c(1000L, 1000L, 1004L),
admission_mode = c(20L, 20L, 26L),
admission_date = structure(c(-3653, -3653, -2922),
class = c("Date")),
abolition_nr = c(1004L, 1004L, NA),
abolition_mode = c(29L, 26L, NA),
abolition_date = structure(c(-2923, -2923, NA),
class = c("Date")),
change_date = structure(c(-2923, -2923, -2922), class = c("Date"))),
row.names = c(NA, -3L), class = c("tbl_df", "tbl", "data.frame"))

mapping_object <- map_old_to_new_state(mutations,
as.Date("1961-01-01"), as.Date("1963-01-01"))


[Package SMMT version 1.2.0 Index]