if_null {fuj} | R Documentation |
NULL
or no lengthReplace if NULL
or not length
x %||% y
x %|||% y
x %len% y
x , y |
If |
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)
x
if it is not NULL
or has length, depending on check
# 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