Skip to contents

Lists the referendum data from sudd.ch in various ways its list.php endpoint allows. The output of this function can be directly fed to sudd_rfrnds().

Usage

list_sudd_rfrnds(
  mode = c("by_date", "by_mod_date", "filter", "random"),
  order = c("ascending", "descending"),
  filter = list(territory_name_de = NULL, title_de = NULL, year_min = NULL, year_max =
    NULL),
  use_cache = TRUE,
  max_cache_age = "1 week",
  quiet = FALSE
)

Arguments

mode

The listing mode. One of

  • "by_date": Lists all referendums in the sudd.ch database by date, together with their id_sudd, country_code, territory_name_de and title_de. Specifying the sorting order of the results via the order parameter is supported.

  • "by_mod_date": Lists all referendums in the sudd.ch database by date_last_edited, together with their id_sudd, country_code, territory_name_de, date and title_de.

  • "filter": Allows to provide additional arguments (via the filter parameter) that limit the results accordingly. Specifying the sorting order of the results via the order parameter is supported.

  • "random": Lists the id_sudd of five randomly selected referendums, together with their country_code.

order

The sorting order of the results. Only relevant if mode is either "by_date" or "filter".

filter

A list with valid filtering arguments. Only relevant if mode = "filter". The supported filtering arguments include

  • territory_name_de: A string that must be (partially) matched by the referendums' territory_name_de. Matching is case-insensitive and no fuzzy matching is supported.

  • title_de: A string that must be (partially) matched by the referendums' title_de. Matching is case-insensitive and no fuzzy matching is supported.

  • year_min: The lower year limit of the referendums' date. A positive integer.

  • year_max: The upper year limit of the referendums' date. A positive integer.

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.

quiet

Whether or not to suppress printing status output from internal processing.

Value

A tibble containing at least an id_sudd column.

About sudd.ch

sudd stands for Suchmaschine für direkte Demokratie (German) and is operated by Beat Müller. Its database content is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).

See also

Other sudd.ch scraping functions: list_sudd_territories(), list_sudd_titles(), sudd_rfrnds()

Examples

# list all referendums by modification date (takes a while)
if (FALSE) {
rdb::list_sudd_rfrnds(mode = "by_mod_date")}

# list all referendums whose title matches "AHV"
rdb::list_sudd_rfrnds(mode = "filter",
                      filter = list(title_de = "AHV"),
                      quiet = TRUE)
#> # A tibble: 17 × 11
#>    id_sudd  country_code country_name is_former_country subnational_entity_code territory_name_de date        year month   day title_de                         
#>    <chr>    <chr>        <chr>        <lgl>             <chr>                   <chr>             <date>     <int> <int> <int> <chr>                            
#>  1 ch021978 CH           Switzerland  FALSE             NA                      Schweiz           1978-02-26  1978     2    26 Alters- und Hinterlassenenversic…
#>  2 ch031978 CH           Switzerland  FALSE             NA                      Schweiz           1978-02-26  1978     2    26 Herabsetzung des AHV-Alters      
#>  3 ch021988 CH           Switzerland  FALSE             NA                      Schweiz           1988-06-12  1988     6    12 Herabsetzung des AHV-Rentenalter…
#>  4 ch051995 CH           Switzerland  FALSE             NA                      Schweiz           1995-06-25  1995     6    25 Alters- und Hinterlassenenversic…
#>  5 ch061995 CH           Switzerland  FALSE             NA                      Schweiz           1995-06-25  1995     6    25 Ausbau von AHV und IV            
#>  6 ch061998 CH           Switzerland  FALSE             NA                      Schweiz           1998-09-27  1998     9    27 10. AHV-Revision ohne Erhöhung d…
#>  7 ch082001 CH           Switzerland  FALSE             NA                      Schweiz           2001-12-02  2001    12     2 Sicherung der AHV durch Besteuer…
#>  8 ch052002 CH           Switzerland  FALSE             NA                      Schweiz           2002-09-22  2002     9    22 Überschüssige Goldreserven in de…
#>  9 ch042004 CH           Switzerland  FALSE             NA                      Schweiz           2004-05-16  2004     5    16 Alters- und Hinterlassenenversic…
#> 10 ch052004 CH           Switzerland  FALSE             NA                      Schweiz           2004-05-16  2004     5    16 Finanzierung der AHV/IV durch An…
#> 11 ch022006 CH           Switzerland  FALSE             NA                      Schweiz           2006-09-24  2006     9    24 Nationalbankgewinne für die AHV  
#> 12 ch072008 CH           Switzerland  FALSE             NA                      Schweiz           2008-11-30  2008    11    30 Flexibles AHV-Alter              
#> 13 ch112016 CH           Switzerland  FALSE             NA                      Schweiz           2016-09-25  2016     9    25 Höhere AHV-Renten (AHV plus)     
#> 14 ch062017 CH           Switzerland  FALSE             NA                      Schweiz           2017-09-24  2017     9    24 Zusatzfinanzierung der AHV durch…
#> 15 ch022019 CH           Switzerland  FALSE             NA                      Schweiz           2019-05-19  2019     5    19 Steuerreform und AHV-Finanzierung
#> 16 ch092022 CH           Switzerland  FALSE             NA                      Schweiz           2022-09-25  2022     9    25 Zusatzfinanzierung der AHV durch…
#> 17 ch102022 CH           Switzerland  FALSE             NA                      Schweiz           2022-09-25  2022     9    25 AHV-Gesetz (AHV 21)              

# get sudd.ch referendum data from all referendums from 2020 onwards
rdb::list_sudd_rfrnds(mode = "filter",
                      filter = list(year_min = 2020),
                      quiet = TRUE) |>
  rdb::sudd_rfrnds(quiet = TRUE)
#> # A tibble: 58 × 37
#>    id_sudd  country_code country_name       is_former_country subnational_entity_code territory_name_de territory_type_de  date        year month   day title_de
#>    <chr>    <chr>        <chr>              <lgl>             <chr>                   <chr>             <chr>              <date>     <int> <int> <int> <chr>   
#>  1 ch012020 CH           Switzerland        FALSE             NA                      Schweiz           unabhängiger Staat 2020-02-09  2020     2     9 Mehr be…
#>  2 ch022020 CH           Switzerland        FALSE             NA                      Schweiz           unabhängiger Staat 2020-02-09  2020     2     9 Strafge…
#>  3 fr012020 FR           France             FALSE             NA                      Frankreich        unabhängiger Staat 2020-03-15  2020     3    15 Rückzug…
#>  4 gn012020 GN           Guinea             FALSE             NA                      Guinea            unabhängiger Staat 2020-03-22  2020     3    22 Verfass…
#>  5 pw012020 PW           Palau              FALSE             NA                      Palau             unabhängiger Staat 2020-05-01  2020     5     1 Festleg…
#>  6 ru012020 RU           Russian Federation FALSE             NA                      Russland          unabhängiger Staat 2020-07-01  2020     7     1 Verfass…
#>  7 ru022020 RU           Russian Federation FALSE             NA                      Russland          unabhängiger Staat 2020-07-01  2020     7     1 Staatsb…
#>  8 ru032020 RU           Russian Federation FALSE             NA                      Russland          unabhängiger Staat 2020-07-01  2020     7     1 Bodensc…
#>  9 ru042020 RU           Russian Federation FALSE             NA                      Russland          unabhängiger Staat 2020-07-01  2020     7     1 Tiefere…
#> 10 ru052020 RU           Russian Federation FALSE             NA                      Russland          unabhängiger Staat 2020-07-01  2020     7     1 Indexie…
#> # ℹ 48 more rows
#> # ℹ 25 more variables: question_type_de <chr>, result_de <chr>, result_status_de <chr>, adoption_requirements_de <list>, electorate_total <int>,
#> #   electorate_abroad <int>, polling_cards <int>, votes_total <int>, votes_empty <int>, votes_void <int>, votes_invalid <int>, votes_valid <int>,
#> #   votes_yes <int>, votes_no <int>, votes_option_1 <int>, votes_option_2 <int>, votes_option_3 <int>, subterritories <dbl>, subterritories_yes <dbl>,
#> #   subterritories_no <dbl>, files <list>, remarks <list>, sources <list>, ids_sudd_simultaneous <list>, date_last_edited <date>

# get sudd.ch referendum data from five randomly picked referendums
rdb::list_sudd_rfrnds(mode = "random",
                      quiet = TRUE) |>
  rdb::sudd_rfrnds(quiet = TRUE)
#> # A tibble: 5 × 33
#>   id_sudd  country_code country_name is_former_country subnational_entity_code territory_name_de         territory_type_de date        year month   day title_de
#>   <chr>    <chr>        <chr>        <lgl>             <chr>                   <chr>                     <chr>             <date>     <int> <int> <int> <chr>   
#> 1 ro011866 RO           Romania      FALSE             NA                      Rumänien                  Staatsteil mit A… 1866-04-20  1866     4    20 Karl Lu…
#> 2 km011974 KM           Comoros      FALSE             NA                      Komoren                   abhängiges Gebie… 1974-12-22  1974    12    22 Unabhän…
#> 3 fm221991 FM           Micronesia   FALSE             NA                      Mikronesischer Staatenbu… unabhängiger Sta… 1991-07-02  1991     7     2 Präzisi…
#> 4 ch031997 CH           Switzerland  FALSE             NA                      Schweiz                   unabhängiger Sta… 1997-06-08  1997     6     8 Aufhebu…
#> 5 gl012008 GL           Greenland    FALSE             NA                      Grönland                  abhängiges Gebie… 2008-11-25  2008    11    25 Erweite…
#> # ℹ 21 more variables: question_type_de <chr>, result_de <chr>, result_status_de <chr>, adoption_requirements_de <list>, electorate_total <int>,
#> #   electorate_abroad <int>, votes_total <int>, votes_empty <int>, votes_void <int>, votes_invalid <int>, votes_valid <int>, votes_yes <int>, votes_no <int>,
#> #   votes_option_1 <int>, subterritories <dbl>, subterritories_yes <dbl>, subterritories_no <dbl>, remarks <list>, sources <list>,
#> #   ids_sudd_simultaneous <list>, date_last_edited <date>