near

0th

Percentile

Compare two numeric vectors

This is a safe way of comparing if two vectors of floating point numbers are (pairwise) equal. This is safer than using ==, because it has a built in tolerance

Usage
near(x, y, tol = .Machine$double.eps^0.5)
Arguments
x, y

Numeric vectors to compare

tol

Tolerance of comparison.

Aliases
  • near
Examples
# NOT RUN {
sqrt(2) ^ 2 == 2
near(sqrt(2) ^ 2, 2)
# }
Documentation reproduced from package dplyr, version 0.7.3, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.