Learn R Programming

sortinghat (version 0.1)

all_equal: Function to check whether all elements in a numeric vector are equal within some tolerance

Description

Function to check whether all elements in a numeric vector are equal within some tolerance

Usage

all_equal(x, tol = .Machine$double.eps^0.5)

Arguments

x
numeric vector
tol
tolerance value

Value

  • logical value

Examples

Run this code
# Returns TRUE
all_equal(c(3, 3, 3))
# Returns FALSE
all_equal(c(3, 3, 2))

Run the code above in your browser using DataLab