Skip to contents

Like rlang::%||%() but also checks for empty lists and empty strings.

Usage

x %none% y

Arguments

x

object to test

y

object to return if is.none(x)

Value

Returns y if is.none(x) else x

See also

Examples

FALSE %none% 2 # returns 2
#> [1] 2
0 %none% 2 # returns 2
#> [1] 2
NA %none% 2 # returns 2
#> [1] 2
list() %none% 2 # returns 2
#> [1] 2
"" %none% 2 # returns 2
#> [1] 2
1 %none% 2 # returns 1
#> [1] 1