add_lead: Add Lead of One Party Over Another

View source: R/add.R

add_leadR Documentation

Add Lead of One Party Over Another

Description

We often want to know how much further one party is ahead of another in the polls. But this can be tricky when the polls contain error. This function takes a dataset with columns named "party_est" and "party_err", computes the lead of one party over another, and appends it plus the error in the estimate to the data.

Usage

add_lead(data = NULL, party1 = "con", party2 = "lab", name = "lead")

Arguments

data

A dataset containing variables called party_est and party_err

party1

The name of party

party2

The name of your date variable in your data.

name

The name . Defaults to "lead".

Value

A tibble of data.

Examples

add_lead(data = pollbasepro, party1 = "con", party2 = "lab")

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