add_lead: Add Lead of One Party Over Another

Description Usage Arguments Value Examples

View source: R/add.R

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

1
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

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

jackobailey/PollBasePro documentation built on Nov. 26, 2021, 7:41 p.m.