Learn R Programming

hablar (version 0.3.2)

create_dummy: 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)

Value

a vector of the integers 1, 0 and NA (if not dummy_ is used).

Arguments

condition

a predicament

missing

a replacement if condition is NA

See Also

vignette("hablar")

Examples

Run this code
v <- c(10, 5, 3, NA, 9)
dummy(v > 5)
dummy_(v > 5)

Run the code above in your browser using DataLab