op-na-default
From rlang v0.1.6
by Lionel Henry
Replace missing values
This infix function is similar to %||%
but is vectorised
and provides a default value for missing elements. It is faster
than using base::ifelse()
and does not perform type conversions.
Usage
x %|% y
Arguments
- x, y
y
for elements ofx
that are NA; otherwise,x
.
See Also
Examples
# NOT RUN {
c("a", "b", NA, "c") %|% "default"
# }
Community examples
Looks like there are no examples yet.