if_null {fuj} | R Documentation |
Default value for NULL
or no length
Description
Replace if NULL
or not length
Usage
x %||% y
x %|||% y
x %len% y
Arguments
x , y |
If |
Details
A mostly copy of rlang
's %||%
except does not use rlang::is_null()
,
which, currently, calls the same primitive base::is.null function.
Note: %||%
is copied from {base}
if available (R versions >= 4.4)
Value
x
if it is not NULL
or has length, depending on check
Examples
# replace NULL (for R < 4.4)
NULL %||% 1L
2L %||% 1L
# replace empty
"" %|||% 1L
NA %|||% 1L
double() %|||% 1L
NULL %|||% 1L
# replace no length
logical() %len% TRUE
FALSE %len% TRUE
[Package fuj version 0.2.1 Index]