grapes-equals-grapes: Test if Two Numeric Vectors are (Nearly) Equal Row-by-Row

%==%R Documentation

Test if Two Numeric Vectors are (Nearly) Equal Row-by-Row

Description

Implements isTRUE(all.equal()) on a row-by-row basis. x and y can be of different lengths, including length() == 1. Handy for making comparisons between data frame columns within filter and similar functions.

Usage

x %==% y

Arguments

x

A numeric or integer vector. May be of length 1.

y

A numeric or integer vector to compare to x. May be of length 1.

Value

A logical vector of TRUE and FALSE values indicating which rows are (nearly) equal.

See Also

all.equal

Examples

## Not run: 
 x <- 1L
 y <- 1.001
 x == y
 # FALSE
 x %==% y
 # FALSE
 y <- 1.00000001
 x == y
 # FALSE
 x %==% y
 # TRUE
 x <- c(1, 2)
 x == y
 # FALSE FALSE
 x %==% y
 # TRUE FALSE

## End(Not run)

tomhopper/numbr documentation built on Nov. 5, 2022, 11:35 p.m.