label_party: Label Partisan Vote Shares

label_party_marginR Documentation

Label Partisan Vote Shares

Description

For example, a 45% Democratic vote share becomes "R+10" or "55% R".

Usage

label_party_margin(midpoint = 0.5, reverse = FALSE, accuracy = 1)

label_party_pct(midpoint = 0.5, reverse = FALSE, accuracy = 1)

Arguments

midpoint

Either 0.5, the default, or 0. For label_party_margin(), if zero, scale will not be doubled (0.05 becomes "D+5" with midpoint=0, while 0.55 becomes "D+10" with 'midpoint=0.5)

reverse

If TRUE, reverse "D" and "R".

accuracy

As with scales::number_format

Value

A labeling function

Examples

labeler = label_party_margin(accuracy=0.1)
labeler(c(0.3, 0.5, 0.543))
labeler = label_party_margin(reverse=TRUE)
labeler(c(0.3, 0.5, 0.543))


alarm-redist/ggredist documentation built on July 1, 2024, 8:51 p.m.