op-null-default | R Documentation |
Like rlang::%||%()
but also checks for empty lists and empty strings.
x %none% y
x |
object to test |
y |
object to return if |
Returns y
if is.none(x)
else x
is.none()
FALSE %none% 2 # returns 2
0 %none% 2 # returns 2
NA %none% 2 # returns 2
list() %none% 2 # returns 2
"" %none% 2 # returns 2
1 %none% 2 # returns 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.