comparison_replace {inops}R Documentation

Replacing Values by Comparison

Description

Operators for replacing values using the standard comparison operators.

Usage

x >= y <- value

x > y <- value

x <= y <- value

x < y <- value

x == y <- value

x != y <- value

Arguments

x

first element of the operation.

y

second element of the operation.

value

replacement value.

Details

Thanks to these operators :

Value

x with values for which the comparisons evaluate to TRUE replaced with value.

See Also

`==`

Examples

ages <- c(130, 10, 1996, 21, 39, 74, -2, 0)

ages == 1996 <- as.numeric(format(Sys.Date(), "%Y")) - 1986
ages

ages > 100 <- NA
ages

ages <= 0 <- NA
ages


[Package inops version 0.0.1 Index]