| get_county_data | R Documentation |
Reads a county-level .RData file and returns its contents as a
data.frame. The data source is resolved in this order:
The source argument (if not NULL).
getOption("data_dir") (set once with options(data_dir = ...)).
The default OSF repository (online).
get_county_data(county, source = NULL)
county |
Character string. County code, e.g. |
source |
Character string or |
To avoid specifying source in every call, set options(data_dir) once
at the start of your session or in your .Rprofile:
options(data_dir = "~/my_data/") # local files # or leave unset to use the online OSF repository
A data.frame with one row per voter and columns:
COUNTY: county code.
PRECINCT: precinct identifier within the county.
One column per race on the ballot (see election_catalog for the code-to-office mapping).
get_election_data(), ei_summary(), list_counties()
# From the online repository
lee <- get_county_data("Lee")
# From a local directory
lee <- get_county_data("Lee", source = "~/local_data/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.