Description Usage Arguments Value Examples
The function is useful as a way of providing a default value
in case the output of another function is NULL
.
1 | a %if_null% b
|
a |
An expression. |
b |
An alternative |
If !is.null(a)
is TRUE
returns a
otherwise
returns b
.
1 2 3 4 5 6 7 8 9 | a1 <- "Default value"
a2 <- NULL
b <- "Alternative"
a1 %if_null% b
#> [1] "Default value"
a2 %if_null% b
#> "Alternative"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.