Augments data with additional columns holding URLs of the specified types. The new columns will be named after types, prefixed with url_, so
types = "sudd" will add the column url_sudd etc.
Usage
add_urls(data, types = c("sudd", "swissvotes"))Arguments
- data
RDB referendum data as returned by
rfrnds(). A data frame that at minimum contains the columnid_suddfortypes = "sudd"and the columnscountry_code,levelandid_officialfortypes = "swissvotes".- types
Type(s) of URLs to add. One or more of
"sudd"or"swissvotes".
Value
A tibble.
See also
Other referendum data augmentation functions:
add_country_code_continual(),
add_country_code_long(),
add_country_name(),
add_country_name_long(),
add_former_country_flag(),
add_period(),
add_turnout(),
add_world_regions()
Examples
rdb::rfrnds(quiet = TRUE) |>
dplyr::filter(country_code == "CH" & level == "national") |>
rdb::add_urls() |>
dplyr::select(id,
country_code,
level,
starts_with("id_"),
starts_with("url_"))
#> # A tibble: 689 × 7
#> id country_code level id_official id_sudd url_sudd url_swissvotes
#> <chr> <fct> <ord> <chr> <chr> <chr> <chr>
#> 1 66505b3fc3cd67046057fe07 CH national NA NA NA NA
#> 2 6650452ac3cd67046057fe03 CH national NA NA NA NA
#> 3 665044a8c3cd67046057fe01 CH national NA NA NA NA
#> 4 665043f1c3cd67046057fdfe CH national NA NA NA NA
#> 5 65bcbc1974e3a61b5661da12 CH national NA NA NA NA
#> 6 65bca88174e3a61b5661da08 CH national NA ch012024 https://sudd.ch/event.php?id=ch012024 NA
#> 7 6442587e0b8bae0c78c7e9de CH national NA NA NA NA
#> 8 644257630b8bae0c78c7e9da CH national NA NA NA NA
#> 9 644255f50b8bae0c78c7e9d6 CH national NA NA NA NA
#> 10 63403d2da52c3995043a9208 CH national 661 ch112022 https://sudd.ch/event.php?id=ch112022 https://swissvotes.ch/vote/661
#> # ℹ 679 more rows