powered by
Like rlang::%||%() but also checks for empty lists and empty strings.
rlang::%||%()
x %none% y
Returns y if is.none(x) else x
y
is.none(x)
x
object to test
object to return if is.none(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
Run the code above in your browser using DataLab