Replace values satisfying a predicate
Arguments
- x
A vector.
- f
A function, called with
x. The return value is used to select elements inxto replace withvalues.- values
Values assigned to elements of
xsatisfyingf.
See also
replace() which this thinly wraps.
Examples
replace_if(c(1, NA, 3), is.na, 42)
#> [1] 1 42 3