Skip to contents

This function produces a tibble containing the names and BFS-numbers (official municipality numbers) of all existing municipalities in a given year. Filtering by canton is supported.

Usage

swc_get_municipality_state(year, canton = NULL)

Arguments

year

Year of interest (integer).

canton

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

Value

Tibble containing municipality numbers (BFS-numbers) and names of existing municipalities in the given year.

Examples

swc_get_municipality_state(1987)
#> # A tibble: 3,028 × 2
#>    mun_id short_name        
#>     <int> <chr>             
#>  1      1 Aeugst am Albis   
#>  2      2 Affoltern am Albis
#>  3      3 Bonstetten        
#>  4      4 Hausen am Albis   
#>  5      5 Hedingen          
#>  6      6 Kappel am Albis   
#>  7      7 Knonau            
#>  8      8 Maschwanden       
#>  9      9 Mettmenstetten    
#> 10     10 Obfelden          
#> # ℹ 3,018 more rows
swc_get_municipality_state(2000, "ZH")
#> # A tibble: 171 × 2
#>    mun_id short_name        
#>     <int> <chr>             
#>  1      1 Aeugst am Albis   
#>  2      2 Affoltern am Albis
#>  3      3 Bonstetten        
#>  4      4 Hausen am Albis   
#>  5      5 Hedingen          
#>  6      6 Kappel am Albis   
#>  7      7 Knonau            
#>  8      8 Maschwanden       
#>  9      9 Mettmenstetten    
#> 10     10 Obfelden          
#> # ℹ 161 more rows