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_sudd
fortypes = "sudd"
and the columnscountry_code
,level
andid_official
fortypes = "swissvotes"
.- types
Type(s) of URLs to add. One 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: 685 × 7
#> id country_code level id_official id_sudd url_sudd url_swissvotes
#> <chr> <fct> <ord> <chr> <chr> <chr> <chr>
#> 1 65bcbc1974e3a61b5661da12 CH national NA NA NA NA
#> 2 65bca88174e3a61b5661da08 CH national NA ch012024 https://sudd.ch/event.php?id=ch012024 NA
#> 3 6442587e0b8bae0c78c7e9de CH national NA NA NA NA
#> 4 644257630b8bae0c78c7e9da CH national NA NA NA NA
#> 5 644255f50b8bae0c78c7e9d6 CH national NA NA NA NA
#> 6 63403d2da52c3995043a9208 CH national 661 ch112022 https://sudd.ch/event.php?id=ch112022 https://swissvotes.ch/vote/661
#> 7 63403a96a52c3995043a91f9 CH national 658 ch082022 https://sudd.ch/event.php?id=ch082022 https://swissvotes.ch/vote/658
#> 8 634035bba52c3995043a91e2 CH national 659 ch092022 https://sudd.ch/event.php?id=ch092022 https://swissvotes.ch/vote/659
#> 9 634029b9a52c3995043a91d1 CH national 660 ch102022 https://sudd.ch/event.php?id=ch102022 https://swissvotes.ch/vote/660
#> 10 62c68fd613bed420d6ffbdf8 CH national NA NA NA NA
#> # ℹ 675 more rows