In Switzerland, the landscape of municipalities is changing rapidly mainly due to mergers. The Swiss Municipality Merger Tool (SMMT) automatically detects these mutations and maps municipalities of an old state to municipalities of a new state. The aim of this vignette is to illustrate how to use the functionality of the SMMT.This figure shows the decrease in municipalities over time:
<- download_municipality_inventory(path = getwd())path_inventory_xml
<- import_CH_municipality_inventory(file_path = path_inventory_xml) mutations_object <- mutations_object$mutations mutations # Alternative: Use a local available version (e.g. Version from January 1st, 2018): <- "path/to/eCH0071_180101.xml" file_path_inventory_xml <- import_CH_municipality_inventory(file_path = file_path_inventory_xml) mutations_object <- mutations_object$mutationsmutations
<- as.Date("1961-01-01") old_state <- as.Date("1963-01-01")new_state
<- map_old_to_new_state(mutations, old_state, new_state) mapping_object <- mapping_object$mappedmapping_table
Excerpt of mapping table:
If of relevance, use the information about municipalities which could not be mapped (e.g. due to secessions). For example, if you need to exclude these elements from a dataset.