Skip to contents

Produces a mapping table that can be joined to your data. Municipalities that were merged to another municipality during the given time period are mapped to that municipality. Filtering by canton is supported.

Usage

swc_get_merger_mapping_table(
  start_year,
  end_year,
  canton = NULL,
  type = "flat"
)

Arguments

start_year

First year of time interval (integer)

end_year

Last year of time interval (integer)

canton

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

type

Two options:

- "flat" (default) returns the table with one row per year per mapping

- "compact" returns a more compact table with one row per mapping, containing the time interval it is valid for

Value

Mapping table for the given time interval in the specified canton

Examples

swc_get_merger_mapping_table(2005, 2010)
#> # A tibble: 16,203 × 5
#>     year mun_id_x short_name_x       mun_id_y short_name_y      
#>    <dbl>    <int> <chr>                 <int> <chr>             
#>  1  2005        1 Aeugst am Albis           1 Aeugst am Albis   
#>  2  2005        2 Affoltern am Albis        2 Affoltern am Albis
#>  3  2005        3 Bonstetten                3 Bonstetten        
#>  4  2005        4 Hausen am Albis           4 Hausen am Albis   
#>  5  2005        5 Hedingen                  5 Hedingen          
#>  6  2005        6 Kappel am Albis           6 Kappel am Albis   
#>  7  2005        7 Knonau                    7 Knonau            
#>  8  2005        8 Maschwanden               8 Maschwanden       
#>  9  2005        9 Mettmenstetten            9 Mettmenstetten    
#> 10  2005       10 Obfelden                 10 Obfelden          
#> # ℹ 16,193 more rows
swc_get_merger_mapping_table(2015, 2019, canton = "ZH", type = "compact")
#> # A tibble: 174 × 6
#>    year_from year_to mun_id_x short_name_x       mun_id_y short_name_y      
#>        <dbl>   <dbl>    <int> <chr>                 <int> <chr>             
#>  1      2015    2019        1 Aeugst am Albis           1 Aeugst am Albis   
#>  2      2015    2019        2 Affoltern am Albis        2 Affoltern am Albis
#>  3      2015    2019        3 Bonstetten                3 Bonstetten        
#>  4      2015    2019        4 Hausen am Albis           4 Hausen am Albis   
#>  5      2015    2019        5 Hedingen                  5 Hedingen          
#>  6      2015    2019        6 Kappel am Albis           6 Kappel am Albis   
#>  7      2015    2019        7 Knonau                    7 Knonau            
#>  8      2015    2019        8 Maschwanden               8 Maschwanden       
#>  9      2015    2019        9 Mettmenstetten            9 Mettmenstetten    
#> 10      2015    2019       10 Obfelden                 10 Obfelden          
#> # ℹ 164 more rows