%>=% | R Documentation |
Binary operators which allow the comparison of values in numeric vectors.
x %>=% y x %>>% y x %<=% y x %<<% y x %==% y x %!=% y
x |
Any numeric object. |
y |
Any numeric object. |
These are similar to their counterparts in base
, except a tolerance
fpCompare.tolerance
can be specified via options
to account
for floating point rounding errors:
fpCompare | base |
---------------- | ----------- |
%>=% | >= |
%>>% | > |
%<=% | <= |
%<<% | < |
%==% | == |
%!=% | != |
Inspired by R FAQ 7.31 (https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f) and this post (https://stackoverflow.com/a/2769618/1380598).
A logical vector indicating the result of the element by element comparison. The elements of shorter vectors are recycled as necessary.
Alex Chubaty
all.equal
, .Machine
x1 <- 0.5 - 0.3 x2 <- 0.3 - 0.1 x1 == x2 # FALSE on most machines x1 %==% x2 # TRUE everywhere identical(all.equal(x1, x2), TRUE) # TRUE everywhere set.seed(123) a <- 1:6 b <- jitter(1:6, 1e-7) print(rbind(a, b), digits = 16) b %<=% a b %<<% a b %>=% a b %>>% a b %==% a b %!=% a
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.