powered by
NULL
Set a default value depending on if an object is NULL
x %||% yx %iff% y
x %iff% y
For %||%: y if x is NULL; otherwise x
%||%
y
x
For %iff%: y if x is not
%iff%
NULL; otherwise x
An object to test
A default value
For %||%: rlang developers
rlang::%||%
# Set if NULL 1 %||% 2 NULL %||% 2 # Set if *not* NULL 1 %iff% 2 NULL %iff% 2
Run the code above in your browser using DataLab