Skip to contents

When your functions wear these rose tinted glasses, the world will appear to be a nicer, fluffier place.

Usage

x %00% y

Arguments

x

If (an element of) x is any of Inf,-Inf,NA,NaN,NULL,length(x)==0, it will return/replace the value of y; otherwise x.

y

The value to return/replace for x in case of catastrophe >00<

See also

purrrr::%||%

Author

Fred Hasselman

Examples


Inf %00% NA
#> [1] NA

numeric(0) %00% ''
#> [1] ""

NA %00% 0
#> [1] 0

NaN %00% NA
#> [1] NA
c(1, NaN) %00% NA
#> [1]  1 NA

NULL %00% NA
#> [1] NA
c(1, NULL) %00% NA # can't see second element
#> [1] 1