Skip to contents

a snapshot is the list of municipalities that exist for at least part of the specified period (or the specified day when start_period = end_period)

Usage

get_snapshots(
  start_period = Sys.Date(),
  end_period = Sys.Date(),
  escape_chars = NULL,
  hist_id = NULL,
  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.

name_repair

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

Value

a data.frame/tibble

Examples

# \donttest{
get_snapshots(
  start_period = "2024-01-01",
  end_period = "2024-08-01"
)
#> # A tibble: 2,302 × 34
#>    Identifier ValidFrom  ValidTo Level Parent Name_en    Name_fr Name_de Name_it
#>         <dbl> <chr>      <chr>   <dbl>  <dbl> <chr>      <chr>   <chr>   <chr>  
#>  1          1 12.09.1848 NA          1     NA Zürich     Zürich  Zürich  Zürich 
#>  2      10053 12.09.1848 NA          2      1 Bezirk Af… Bezirk… Bezirk… Bezirk…
#>  3      10575 12.09.1848 NA          3  10053 Stallikon  Stalli… Stalli… Stalli…
#>  4      11742 12.09.1848 NA          3  10053 Affoltern… Affolt… Affolt… Affolt…
#>  5      11801 12.09.1848 NA          3  10053 Bonstetten Bonste… Bonste… Bonste…
#>  6      11992 01.01.1911 NA          3  10053 Hausen am… Hausen… Hausen… Hausen…
#>  7      12249 12.09.1848 NA          3  10053 Hedingen   Heding… Heding… Heding…
#>  8      12433 12.09.1848 NA          3  10053 Mettmenst… Mettme… Mettme… Mettme…
#>  9      12497 12.09.1848 NA          3  10053 Obfelden   Obfeld… Obfeld… Obfeld…
#> 10      12671 01.01.1911 NA          3  10053 Kappel am… Kappel… Kappel… Kappel…
#> # ℹ 2,292 more rows
#> # ℹ 25 more variables: ABBREV_1_Text_en <chr>, ABBREV_1_Text_fr <chr>,
#> #   ABBREV_1_Text_de <chr>, ABBREV_1_Text_it <chr>, ABBREV_1_Text <chr>,
#> #   CODE_OFS_1_Text_en <dbl>, CODE_OFS_1_Text_fr <dbl>,
#> #   CODE_OFS_1_Text_de <dbl>, CODE_OFS_1_Text_it <dbl>, CODE_OFS_1_Text <dbl>,
#> #   INSCRIPTION_1_Text_en <dbl>, INSCRIPTION_1_Text_fr <dbl>,
#> #   INSCRIPTION_1_Text_de <dbl>, INSCRIPTION_1_Text_it <dbl>, …
# }