near: Compare two numeric vectors.

Description Usage Arguments Examples

View source: R/near.R

Description

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

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

Arguments

x, y

Numeric vectors to compare

tol

Tolerance of comparison.

Examples

1
2
sqrt(2) ^ 2 == 2
near(sqrt(2) ^ 2, 2)

sctyner/dplyr050 documentation built on May 17, 2019, 2:22 p.m.