add_pm: Add Prime Minister to Dated Datasets

View source: R/add.R

add_pmR Documentation

Add Prime Minister to Dated Datasets

Description

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.

Usage

add_pm(data = NULL, date = "date", name = "prime_minister")

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

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(data = dta, date = "date", name = "prime_minister")

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