replacers: replacemnt and specials

replacersR Documentation

replacemnt and specials

Description

If-this-type-then replace with x. And the other way around; replace with x if this.

Usage

if_na(.x, replacement, missing = NULL)

if_nan(.x, replacement, missing = NULL)

if_inf(.x, replacement, missing = NULL)

if_zero(.x, replacement, missing = NULL)

na_if(.x, condition, replace_na = FALSE)

nan_if(.x, condition, replace_na = FALSE)

inf_if(.x, condition, replace_na = FALSE)

zero_if(.x, condition, replace_na = FALSE)

if_not_na(.x, replacement, missing = NULL)

if_inf(.x, replacement, missing = NULL)

if_nan(.x, replacement, missing = NULL)

if_zero(.x, replacement, missing = NULL)

na_if(.x, condition, replace_na = FALSE)

inf_if(.x, condition, replace_na = FALSE)

nan_if(.x, condition, replace_na = FALSE)

zero_if(.x, condition, replace_na = FALSE)

Arguments

.x

a vector

replacement

a replacement if condition is TRUE

missing

a value that replace missing values in condition.

condition

a predicament

replace_na

if TRUE, missing values in condition will be replaced as well

Value

a vector

See Also

vignette("s"), vignette("hablar")

Examples


v <- c(1, NA, 2)
if_na(v, 100)

v <- c(999, NA, 2)
zero_if(v, v == 999)


hablar documentation built on March 31, 2023, 11:54 p.m.