verify: Compare two vectors numerically

Description Usage Arguments Details Value See Also Examples

View source: R/verify.R

Description

Check if all elements of one vector are equal, larger or smaller than those of another vector, allowing for errors in floating-point arithmetic.

Usage

1
2
3
4
5
6
7
verify(a, b)

a %==% b

a %>=% b

a %<=% b

Arguments

a

the first vector to be compared

b

the second vector to be compared

Details

%==% checks for (approximate) equality, %>=% tests if a is greater than or equal to b and %<=% tests the reverse. A %<% or %>% operator would be redundant (and conflict with magrittr).

Be aware that some binary operators, such as `/` take precedence, so make sure to wrap a and b in brackets where appropriate. Use verify(a, b) for a conventional prefix operator.

Value

TRUE or FALSE or NA

See Also

all.equal Comparison identical

Examples

1
2
3
4
0.333333 %==% (1/3)
0.999999 %<=% 1
-1e-16 %>=% 0
verify(pi, 3.141592654)

Selbosh/scrooge documentation built on May 5, 2019, 8 p.m.