Skip to contents

Returns a tibble with a wide range of spatial classifications of Swiss municipalities, i.a. by language region, size of the municipality or degree of agglomeration/urbanization.

Usage

classifications(
  start_date = NULL,
  end_date = NULL,
  historicized_code = FALSE,
  name_type = c("ID", "en", "de", "fr", "it"),
  use_cache = TRUE,
  max_cache_age = "1 day"
)

Arguments

start_date

Begin of the period the data covers. A date or a character scalar in the format "YYYY-MM-DD".

end_date

End of the period the data covers. A date or a character scalar in the format "YYYY-MM-DD".

historicized_code

By default, the FSO commune number is returned. Set to TRUE in order to get the historicization number instead.

name_type

The column name type to be returned. Defaults to the column IDs returned by the web service. If set to a language code, the columns starting with ID HR_ will be named by its full label in the respective language instead.

use_cache

Whether or not to return cached results if possible. If FALSE, results are always newly fetched regardless of max_cache_age.

max_cache_age

Duration after which cached results are refreshed (i.e. newly fetched). A valid lubridate duration. Use Inf to disable cache expiry. Only relevant if use_cache = TRUE. Defaults to 1 day (24 hours).

Value

A tibble.

Details

There are some classifications which have multiple column IDs (e.g. HR_ARBREG2000_L2 and HR_TYPMSR2000_L2 both contain the spatial mobility regions). If name_type is set to a language code, column duplicates are given the name suffix " (⎘)".

FSO commune number vs. historicization number

By default, the FSO commune number is returned. You can set historicized_code = TRUE to get the historicization number instead. Details about the differences between the both can be found in this PDF (in German). A translation of the relevant paragraph (p. 2):

The mutation processes at the cantonal, district and municipal level cause changes in the official register of Swiss municipalities. The so-called historicization number uniquely identifies the entries in the official commune register that have been changed, “deleted” or added as a result of mutation processes.

In contrast to the FSO commune number or district number, the historicization number is unique within the database and defines the state of the communes or districts during a certain period of time. The mutation numbers, the type of inclusion or revocation and the date of inclusion or revocation are used to fully describe the individual mutation events in the “Municipalities” and “Districts” tables. The mutation number identifies the individual mutation events that may affect one or more entries.

The historicization number does not replace the existing municipality and district numbers. It is used for the computer-aided mapping of the various states and mutation processes of the official commune register and the districts.

Examples

swissmuni::classifications(start_date = lubridate::today(),
                           end_date = lubridate::today(),
                           name_type = "de",
                           use_cache = FALSE)
#> # A tibble: 2,131 × 31
#>    Identifier Name       CODE_OFS `Kanton (2023-01-01)` Historisiertes Bezir…¹ `Agglomerationen 2012`    `` Agglomerationsgrösse…² Agglomerationen 2012…³ `NA ⎘`
#>         <int> <chr>         <int>                 <int>                  <int>                  <int> <int>                  <int>                  <int>  <int>
#>  1      10009 Villnache…     4122                    19                  10023                      0     0                      0                      0      0
#>  2      10078 Vionnaz        6158                    23                  10013                      0     0                      0                      0      0
#>  3      10157 Speicher       3023                    15                  10098                   3203  3203                      3                   3203      3
#>  4      10159 Zwischber…     6011                    23                  10035                   6002     0                      5                   6002      0
#>  5      10162 Villars-s…     2228                    10                  10104                   2196  2196                      3                   2196      4
#>  6      10165 Villarsel…     2230                    10                  10104                   2196  2196                      3                   2196      4
#>  7      10242 Wila            181                     1                  10076                      0     0                      0                      0      0
#>  8      10268 Wil (ZH)         71                     1                  10081                    261   261                      1                    261      1
#>  9      10275 Wettingen      4045                    19                  10025                   4021  4021                      3                   4021      3
#> 10      10277 Wetzikon …      121                     1                  10079                    261   261                      1                    261      1
#> # ℹ 2,121 more rows
#> # ℹ abbreviated names: ¹​`Historisiertes Bezirkverzeichnis der Schweiz (2023-01-01)`, ²​`Agglomerationsgrössenklasse 2012`, ³​`Agglomerationen 2012 ⎘`
#> # ℹ 21 more variables: `NA ⎘ ⎘` <int>, `Arbeitsmarktgrossregionen 2018` <int>, `Arbeitsmarktregionen 2018` <int>,
#> #   `Urbanisierungsgrad 2011 (DEGURBA) - eurostat 2011` <int>, `Funktionale städtische Gebiete 2014 (FUA eurostat)` <int>,
#> #   `Erweiterte Städte 2011 (Greater cities eurostat)` <int>, `Städtische / Ländliche Gebiete` <int>, `Gemeindetypologie 2012 (9 Typen)` <int>,
#> #   `Gemeindetypologie 2012 (25 Typen)` <int>, `NA ⎘ ⎘ ⎘` <int>, `NA ⎘ ⎘ ⎘ ⎘` <int>, `NA ⎘ ⎘ ⎘ ⎘ ⎘` <int>, Berggebiete <int>,
#> #   `Grossregionen der Schweiz` <int>, `Raum mit städtischem Charakter 2012` <int>, `NA ⎘ ⎘ ⎘ ⎘ ⎘ ⎘` <int>, `Sprachgebiete 2020` <int>, …