Skip to contents

The geographical levels offer several classifications of municipalities according to, for example, linguistic regions, agglomerations or even the degree of urbanization.

Usage

get_levels(
  start_period = Sys.Date(),
  end_period = Sys.Date(),
  escape_chars = NULL,
  hist_id = NULL,
  label_languages = c("", "de", "fr", "it", "en"),
  name_repair = "unique"
)

Arguments

start_period

Start of requested period

end_period

End of requested period

escape_chars

Defines forbidden characters in the response and their respective escape characters. For example, with the value "/( ).(_)", all slashes in the response will be replaced with a space while periods are replaced with underscore.

hist_id

Determines whether BFSNR (snapshot) or HISTID (geographic levels) will be delivered.

label_languages

Include labels for the specified languages. Languages are specified using the ISO 639-1 code (i.e., French ("fr"), German ("de"), Italian ("it") and English ("en")) and are separated by a comma ",".

name_repair

read_csv is used internally and ensures column names are "unique" using the "name_repeir" argument.

Value

a data.frame/tibble

Examples

# \donttest{
get_levels(
  start_period = "2024-01-01",
  end_period = "2024-08-01"
)
#> Warning: One or more parsing issues, call `problems()` on your data frame for details,
#> e.g.:
#>   dat <- vroom(...)
#>   problems(dat)
#> # A tibble: 2,133 × 33
#>    Identifier Name          CODE_OFS HR_HGDE_HIST_L1 HR_HGDE_HIST_L2 HR_AGGL2012
#>         <dbl> <chr>            <dbl>           <dbl>           <dbl>       <dbl>
#>  1      10009 Villnachern       4122              19           10023           0
#>  2      10078 Vionnaz           6158              23           10013           0
#>  3      10157 Speicher          3023              15           10098        3203
#>  4      10159 Zwischbergen      6011              23           10035        6002
#>  5      10162 Villars-sur-…     2228              10           10104        2196
#>  6      10165 Villarsel-su…     2230              10           10104        2196
#>  7      10242 Wila               181               1           10076           0
#>  8      10268 Wil (ZH)            71               1           10081         261
#>  9      10275 Wettingen         4045              19           10025        4021
#> 10      10277 Wetzikon (ZH)      121               1           10079         261
#> # ℹ 2,123 more rows
#> # ℹ 27 more variables: HR_AGGL2020 <dbl>, HR_AGGLGK2012_L1 <dbl>,
#> #   HR_AGGLGK2012_L2 <dbl>, HR_AGGLGK2020_L1 <dbl>, HR_AGGLGK2020_L2 <dbl>,
#> #   HR_BAE2018_L1 <chr>, HR_BAE2018_L2 <chr>, HR_DEGURB2011 <dbl>,
#> #   HR_FUA2014 <dbl>, HR_GCITIES2011 <dbl>, HR_GDETYP2012_L1 <dbl>,
#> #   HR_GDETYP2012_L2 <dbl>, HR_GDETYP2012_L3 <dbl>, HR_GDETYP2020_L1 <dbl>,
#> #   HR_GDETYP2020_L2 <dbl>, HR_GDETYP2020_L3 <dbl>, HR_MONT2019 <dbl>, …
# }