add_pm_party | R Documentation |
It's often useful to know which party the Prime Minister belonged to at any point in time when analysing political data. This function takes a dataset that includes a dated variable and adds to it a new column that shows the party of the Prime Minister at each moment in time.
add_pm_party(data = NULL, date = "date", name = "pm_party")
data |
A dataset that includes a date variable. |
date |
The name of your date variable in your data. |
name |
What to call the new column of Prime Ministers. Defaults to "pm_party". |
A tibble of data.
dta <- data.frame(date = seq.Date(as.Date("2000-01-01"), as.Date("2020-01-01"), by = "year"))
add_pm_party(data = dta, date = "date", name = "pm_party")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.