set-if-null | R Documentation |
NULL
Set a default value depending on if an object is NULL
x %||% y
x %iff% y
x |
An object to test |
y |
A default value |
For %||%
: y
if x
is NULL
;
otherwise x
For %iff%
: y
if x
is not
NULL
; otherwise x
For %||%
: rlang developers
rlang::%||%
# Set if NULL
1 %||% 2
NULL %||% 2
# Set if *not* NULL
1 %iff% 2
NULL %iff% 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.