View source: R/load_gerda_web.R
| load_gerda_web | R Documentation |
This function loads GERDA data from a web source.
load_gerda_web(
file_name,
verbose = FALSE,
file_format = "rds",
on_error = getOption("gerda.on_error", "warn"),
timeout = getOption("gerda.timeout", 300),
max_retries = getOption("gerda.max_retries", 2),
cache = getOption("gerda.cache", FALSE),
refresh = FALSE
)
file_name |
A character string specifying the name of the file to load. For a list of available data, see |
verbose |
A logical value indicating whether to print additional messages to the console. Default is FALSE. |
file_format |
A character string specifying the format of the file. Must be either "csv" or "rds". Default is "rds". |
on_error |
How to handle errors (unknown dataset name, failed download, corrupt file, invalid |
timeout |
Download timeout in seconds. Defaults to |
max_retries |
Number of additional download attempts after the first, with exponential backoff, if a download fails or returns a Git LFS pointer instead of data. Defaults to |
cache |
Logical; if |
refresh |
Logical; if |
A tibble containing the loaded data, or NULL if the data could not be loaded.
Election datasets expose one column per party (e.g. cdu, spd, gruene, afd).
These columns hold the party's share of valid votes and are expressed as
fractions of 1. They do not sum to 1 across the named major parties:
the remainder is held by smaller parties with their own columns and, at
the tail, an other category. For example, in federal_cty_harm for 2021,
cdu + csu + spd + gruene + fdp + linke_pds + afd is typically around
0.91 and ranges roughly 0.78 to 0.97 across counties. To reconstruct a
full 1.0 share, include every party column or use other together with
turnout and invalid-vote columns.
gerda_data_list() for the dataset catalog, clear_gerda_cache()
and gerda_cache_dir() for cache management.
# These examples download datasets from GitHub (up to ~125 MB each) and are
# therefore not run automatically.
## Not run:
# Load harmonized municipal elections data
data_municipal_harm <- load_gerda_web("municipal_harm", verbose = TRUE, file_format = "rds")
# Load federal election data harmonized to 2025 boundaries (includes 2025 election)
data_federal_2025 <- load_gerda_web("federal_muni_harm_25", verbose = TRUE, file_format = "rds")
# Cache the download so repeated calls in the same project reuse it. Caching
# is opt-in because it writes to gerda_cache_dir() outside the session's
# temporary directory.
data_federal_2025 <- load_gerda_web("federal_muni_harm_25", cache = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.