create_dummy {hablar} | R Documentation |
Creates a vector of the integers 1 and 0. If condition is true it returns 1. If false 0. If condition returns NA it returns NA, if not explicitly not stated than NA should be replaced.
dummy(condition, missing = NA)
dummy_(condition, missing = 0L)
dummy_(condition, missing = 0L)
condition |
a predicament |
missing |
a replacement if condition is NA |
a vector of the integers 1, 0 and NA (if not dummy_ is used).
vignette("hablar")
v <- c(10, 5, 3, NA, 9)
dummy(v > 5)
dummy_(v > 5)