add_pm | R Documentation |
It's often useful to know who the Prime Minister was 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 who the Prime Minister was at each moment in time.
add_pm(data = NULL, date = "date", name = "prime_minister")
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 "prime_minister". |
A tibble of data.
dta <- data.frame(date = seq.Date(as.Date("2000-01-01"), as.Date("2020-01-01"), by = "year"))
add_pm(data = dta, date = "date", name = "prime_minister")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.