add_elections | R Documentation |
It's often useful to know when elections occurred relative to the cases in your data. This function takes a dataset that includes a dated variable and adds to it the date of the last election, next election, or both.
add_elections(
data = NULL,
date = "date",
last_name = "last_elec",
next_name = "next_elec",
which = "both"
)
data |
A dataset that includes a date variable. |
date |
The name of your date variable in your data. |
last_name |
What to call the new column of last election dates. Defaults to "last_elec". |
next_name |
What to call the new column of next election dates. Defaults to "next_elec". |
which |
Which elections to return: "last", "next", or "both". Defaults to "both". |
A tibble of data.
add_elections(data = pollbasepro, date = "date", which = "both")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.