create_dummy {hablar} | R Documentation |
Create a simple dummy
Description
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.
Usage
dummy(condition, missing = NA)
dummy_(condition, missing = 0L)
dummy_(condition, missing = 0L)
Arguments
condition |
a predicament |
missing |
a replacement if condition is NA |
Value
a vector of the integers 1, 0 and NA (if not dummy_ is used).
See Also
vignette("hablar")
Examples
v <- c(10, 5, 3, NA, 9)
dummy(v > 5)
dummy_(v > 5)
[Package hablar version 0.3.2 Index]