<- {}
res %||% "alternative result" res
[1] "alternative result"
Zhenglei Gao
June 12, 2025
To be written.
%||%
Quoted from R base control Help documentation: > The null coalescing operator %||%
is a simple 1-line function: x %||% y is an idiomatic way to call
if (is.null(x)) y else x
# or equivalently, of course,
if(!is.null(x)) x else y
Inspired by Ruby, it was first proposed by Hadley Wickham.
R now has |>
in base.
%T>%