vb_difference {blocs}R Documentation

Calculate differences in bloc contributions

Description

Use vbdf output to calculate differences in blocs' net Republican vote contributions.

Usage

vb_difference(
  vbdf,
  estimates = grep("prob|pr_turnout|pr_votedem|pr_voterep|cond_rep|net_rep",
    names(vbdf), value = TRUE),
  sort_col = "year",
  tolerance = sqrt(.Machine$double.eps)
)

Arguments

vbdf

data.frame holding the results of voting bloc analyses.

estimates

character vector naming the column(s) in vbdf with which to compute differences.

sort_col

character vector naming the column(s) in vbdf to use for sorting before calling diff.

tolerance

tolerance used when checking range of probability estimates

Value

A vbdf object, plus two types of columns: for each column named in estimates, a column named diff_* containing the difference in each estimate across sort_col values, comp, which contains a string tag for the rows compared (e.g., 2020-2016),

A vbdf object.


[Package blocs version 0.1.1 Index]