replacers | R Documentation |
If-this-type-then replace with x. And the other way around; replace with x if this.
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)
.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 |
a vector
vignette("s")
, vignette("hablar")
v <- c(1, NA, 2)
if_na(v, 100)
v <- c(999, NA, 2)
zero_if(v, v == 999)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.