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
TRUEin 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 ofmax_cache_age.- max_cache_age
Duration after which cached results are refreshed (i.e. newly fetched). A valid lubridate duration. Use
Infto disable cache expiry. Only relevant ifuse_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,115 × 34
#> Identifier Name CODE_OFS `Kantone (2025-01-01)` Historisiertes Bezirkve…¹ `Agglomerationen 2012` Urbanisierungsgrad 2…² `Stadt/Land-Typologie`
#> <int> <chr> <int> <int> <int> <int> <int> <int>
#> 1 10009 Villnachern 4122 19 10023 0 2 3
#> 2 10078 Vionnaz 6158 23 10013 0 3 2
#> 3 10157 Speicher 3023 15 10098 3203 2 2
#> 4 10159 Zwischbergen 6011 23 10035 6002 3 3
#> 5 10162 Villars-sur-Glâne 2228 10 10104 2196 2 1
#> 6 10165 Villarsel-sur-Marly 2230 10 10104 2196 3 3
#> 7 10242 Wila 181 1 10076 0 3 2
#> 8 10268 Wil (ZH) 71 1 10081 261 3 3
#> 9 10275 Wettingen 4045 19 10025 4021 2 1
#> 10 10277 Wetzikon (ZH) 121 1 10079 261 2 1
#> # ℹ 2,105 more rows
#> # ℹ abbreviated names: ¹`Historisiertes Bezirkverzeichnis der Schweiz (2025-01-01)`, ²`Urbanisierungsgrad 2011 (DEGURBA) - eurostat 2011`
#> # ℹ 26 more variables: `Gemeindetypologie (9 Typen)` <int>, `Gemeindetypologie (25 Typen)` <int>, `Grossregionen der Schweiz` <int>,
#> # `Raum mit städtischem Charakter` <int>, `Statistische Städte` <int>, `Agglomerationsgrössenklasse 2012` <int>, `Agglomerationen 2012 ⎘` <int>,
#> # `Arbeitsmarktgrossregionen 2018` <int>, `Arbeitsmarktregionen 2018` <int>, Berggebiete <int>, `Funktionale städtische Gebiete 2014 (FUA eurostat)` <int>,
#> # `Erweiterte Städte 2011 (Greater cities eurostat)` <int>, `Sprachgebiete 2020` <int>, `Agglomerationen 2020` <int>, `Stadt/Land-Typologie ⎘` <int>,
#> # `Gemeindetypologie (9 Typen) ⎘` <int>, `Gemeindetypologie (25 Typen) ⎘` <int>, `Raum mit städtischem Charakter ⎘` <int>, `Statistische Städte ⎘` <int>, …