math: Ignore NA in math

math ignore NA in math funsR Documentation

Ignore NA in math

Description

Simplifying math functions are simple wrappers of math function (- +). If any of the left-hand side or right-hand side is NA, Inf or NaN it returns any rational value, if there is any.

However, if the both values are irrational it returns NA. The result is then passed to the corresponding math function.

Usage

.x %minus_% .y

.x %plus_% .y

Arguments

.x

numeric or integer element

.y

numeric or integer element

Value

a single value

See Also

vignette("s"), vignette("hablar")

Examples

## Not run: # The simplest case
3 %minus_% 2

# But with NA it returns 3 as if the NA were zero
3 %minus_% NA

# It doesnt matter if the irrational number is on left- or right-hand.
NA %plus_% 5

## End(Not run)


hablar documentation built on March 31, 2023, 11:54 p.m.