Skip to contents

Referendum data

rfrnds()
Get referendum data
rfrnd()
Get a single referendum's data
download_file_attachment()
Download file attachment
add_rfrnds()
Add new referendums to the RDB
edit_rfrnds()
Edit existing referendums in the RDB
delete_rfrnds()
Delete referendums in the RDB
validate_rfrnds()
Validate referendum data
count_rfrnds()
Count number of referendums
search_rfrnds()
Search in English referendum titles
rfrnd_exists()
Test if referendum ID exists
assert_vars()
Assert referendum variables are present

Referendum metadata

data_codebook
RDB Codebook
val_lbls()
Get set of possible value labels of referendum data variable
val_scale()
Get value scale of referendum data variables
var_vals()
Get set of possible values of referendum data variable
var_name_unnested()
Get unnested variable names
prettify_var_names()
Prettify referendum data variable names

Referendum topics

Functions to work with referendum topics.

data_topics
Topic hierarchy
topics()
List available topics
hierarchize_topics()
Hierarchize topics
hierarchize_topics_fast()
Hierarchize topics (fast)
infer_topics()
Infer higher-tier topics

Augmentation

Functions to augment the RDB referendum data by additional information (columns).

add_former_country_flag()
Add is_former_country flag to referendum data
add_country_code_continual()
Add continual country code to referendum data
add_country_code_long()
Add long country code to referendum data
add_country_name()
Add short country name to referendum data
add_country_name_long()
Add long country name to referendum data
add_period()
Add period to referendum data
add_turnout()
Add turnout to referendum data
add_world_regions()
Add UN world regions to referendum data
add_urls()
Add various URLs to referendum data

Transformation

Functions to transform the RDB referendum data into other shapes, each with a specific purpose.

as_ballot_dates()
Transform to ballot-date-level observations
unnest_var()
Unnest multi-value variable
n_rfrnds()
Count number of referendums
n_rfrnds_per_period()
Count number of referendums per period
prettify_col_names()
Prettify referendum data column names

Visualization

Functions to visualize the RDB referendum data (using plotly).

plot_rfrnd_share_per_period()
Referendum share per period stacked area chart
plot_topic_segmentation()
Topic segmentation sunburst chart
plot_topic_share_per_period()
Topic share per period stacked area chart
ggplot_streamgraph()
Period streamgraph

Tabulation

Functions to create analyses in tabular form (using gt tables).

tbl_n_rfrnds()
Tabulate number of referendums
tbl_n_rfrnds_per_period()
Tabulate number of referendums per period

sudd.ch scraping

Functions to scrape the data from the sudd.ch database.

list_sudd_territories()
List referendum territories from sudd.ch
list_sudd_titles()
List referendum titles from sudd.ch
list_sudd_rfrnds()
List referendum data from sudd.ch
sudd_rfrnds()
Get referendum data from sudd.ch

Miscellaneous

is_online()
Test RDB API availability
pkg_config
rdb package configuration metadata