add_pm_party: Add Prime Minister's Party to Dated Datasets

View source: R/add.R

add_pm_partyR Documentation

Add Prime Minister's Party to Dated Datasets

Description

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.

Usage

add_pm_party(data = NULL, date = "date", name = "pm_party")

Arguments

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".

Value

A tibble of data.

Examples

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")

jackobailey/britpol documentation built on Aug. 6, 2023, 2:30 a.m.