jitter_binary: Create a function to jitter the binary outcome (p89)

View source: R/Plot_Style.R

jitter_binaryR Documentation

Create a function to jitter the binary outcome (p89)

Description

Create a function to jitter the binary outcome (p89)

Usage

jitter_binary(a, jitt = 0.05)

Arguments

a

column with values of 0 or 1

jitt

amount of horizontal and vertical jitter, value between 0 and .5; defaults to .05

Details

From Andrew Gelman and Jennifer Hill. For use in graphs to show the quantity of variable that otherwise would be stuck on a single lines at 0 and 1. This is different from geom_jitter because it keeps all the data within the possible range of the variable, not allowing values greater than 1 or less than 0.

Value

Takes a binary variable and randomly spreads it within 0 and 1

Examples

jitter_binary(contract$b_CBre)


CSISdefense/csis360 documentation built on Aug. 31, 2024, 12:35 a.m.