Skip to contents

If legit lhs, else rhs

Usage

lhs %|legit|% rhs

Arguments

lhs

(expression) to try

rhs

(expression) to replace if expression fails

Value

If legit lhs else rhs

See also

is_legit

Other infixes: %allin%(), %nin%(), %|0|%(), %|%(), %|try|%(), %|zchar|%()

Examples

(100 / NA) %|legit|% 4
#> [1] 4
list(a = 5)$a %|legit|% 4
#> [1] 5
list(a = 5)$b %|legit|% 4
#> [1] 4