powered by
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.
%||%
base::ifelse()
x %|% y
y for elements of x that are NA; otherwise, x.
y
x
op-null-default
# NOT RUN { c("a", "b", NA, "c") %|% "default" # }
Run the code above in your browser using DataLab