swc_get_mutations: Create a list of municipality mutations

View source: R/swc_get_mutations.R

swc_get_mutationsR Documentation

Create a list of municipality mutations

Description

Municipality mutation lists are required to compute matching tables for municipalities between different points in time.

Usage

swc_get_mutations(mids = NULL, canton = NULL)

Arguments

mids

A list of municipality id's (BFS-numbers) of which the mutations should be retrieved.

canton

Canton abbreviation as character (e.g. "GE", "ZH", "TI", etc.) to focus on. If left 'NULL' (default) all cantons are considered.

Details

The municipality dataset of the Swiss historicized communes data is a list of snapshots of municipality states. Each state is valid during a certain period of time, adjoining states are linked by admission and abolition numbers: The abolition number of a former state is the same as the admission number of a subsequent state. The states can be thought of as nodes in a graph, where the edges are mutations – transformations from one state to the next.

This function performs a self-merge on the municipality data: Each abolition number is matched with its corresponding admission number (if available). If no corresponding admission or abolition number is found, the record is included with NAs instead of matched values. Records without admission or abolition number are excluded. The result is a list of mutations, i.e., a list of edges in the graph of municipality state snapshots.

Value

A data frame that represents mutations.

Examples

head(swc_get_mutations(), 20)
head(subset(swc_get_mutations(), !is.na(mHistId.x)), 20)

cynkra/munch documentation built on Dec. 15, 2024, 6:06 a.m.