Description Usage Arguments Value Examples
Function to get vote count data for a given date from the AP API's elections endpoint
1 2 3 4 5 6 7 8 9 10 11 12 13 |
key |
Supplied API key |
date |
Election date supplied in the format of Y-M-D |
state |
Optional parameter for state supplied as postal code, e.g. "IA" |
level |
Level of reporting units. Can take arguments for state, district, fipscode, or reporting unit |
office_id |
AP ID code for the office position. Optionally can be a list or vector of IDs |
winner |
If a winners has been declared. Can supply "X" if a races has a declared winer, R if there is a run-off, U if there is no declared winner, or A for all. Defaults to all. |
race_type |
Type of election. Optionally can be list or vector of types |
party |
political party |
test |
TRUE/FALSE. Whether to use test data (TRUE) or production data (FALSE). Defaults to FALSE. |
uncontested |
Returns a tidy dataframe of election results
1 | test_ia <- get_vote(key = Sys.getenv("apelex_api_key"), level = "fipscode", state = "IA", date = "2020-02-03")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.