assert_all_are_equal_to

0th

Percentile

How does the input relate to a value?

Is x equal/not equal/greater than/less than y?

Usage
assert_all_are_equal_to(x, y, tol = 100 * .Machine$double.eps, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_equal_to(x, y, tol = 100 * .Machine$double.eps, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_not_equal_to(x, y, tol = 100 * .Machine$double.eps, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_not_equal_to(x, y, tol = 100 * .Machine$double.eps, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_greater_than(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_greater_than(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_greater_than_or_equal_to(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_greater_than_or_equal_to(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_less_than(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_less_than(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_all_are_less_than_or_equal_to(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
assert_any_are_less_than_or_equal_to(x, y, na_ignore = FALSE, severity = getOption("assertive.severity", "stop"))
is_equal_to(x, y, tol = 100 * .Machine$double.eps, .xname = get_name_in_parent(x), .yname = get_name_in_parent(x))
is_not_equal_to(x, y, tol = 100 * .Machine$double.eps, .xname = get_name_in_parent(x), .yname = get_name_in_parent(x))
is_greater_than(x, y, .xname = get_name_in_parent(x), .yname = get_name_in_parent(x))
is_greater_than_or_equal_to(x, y, .xname = get_name_in_parent(x), .yname = get_name_in_parent(x))
is_less_than(x, y, .xname = get_name_in_parent(x), .yname = get_name_in_parent(x))
is_less_than_or_equal_to(x, y, .xname = get_name_in_parent(x), .yname = get_name_in_parent(x))
Arguments
x
A numeric vector.
y
Another numeric vector, typically scalar or the same length as x. See note.
tol
Values within tol are considered equal.
na_ignore
A logical value. If FALSE, NA values cause an error; otherwise they do not. Like na.rm in many stats package functions, except that the position of the failing values does not change.
severity
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".
.xname
Not intended to be used directly.
.yname
Not intended to be used directly.
Value

TRUE if the input x is equal/not equal/greater than/less than y

Note

The usual recycling rules apply when x and y are different lengths. See Intro to R for details: https://cran.r-project.org/doc/manuals/r-devel/R-intro.html#Vector-arithmetic https://cran.r-project.org/doc/manuals/r-devel/R-intro.html#The-recycling-rule

Aliases
  • assert_all_are_equal_to
  • assert_all_are_greater_than
  • assert_all_are_greater_than_or_equal_to
  • assert_all_are_less_than
  • assert_all_are_less_than_or_equal_to
  • assert_all_are_not_equal_to
  • assert_any_are_equal_to
  • assert_any_are_greater_than
  • assert_any_are_greater_than_or_equal_to
  • assert_any_are_less_than
  • assert_any_are_less_than_or_equal_to
  • assert_any_are_not_equal_to
  • is_equal_to
  • is_greater_than
  • is_greater_than_or_equal_to
  • is_less_than
  • is_less_than_or_equal_to
  • is_not_equal_to
Examples
library(assertive.numbers) # Approximate and exact floating point comparisons: # See FAQ on R 7.31 x <- sqrt(2) * sqrt(2) is_equal_to(x, 2) is_equal_to(x, 2, tol = 0) is_not_equal_to(x, 2) is_not_equal_to(x, 2, tol = 0) # Elements of x and y are recycled is_equal_to(1:6, 1:3) # Inequalities x <- c(1 - .Machine$double.neg.eps, 1, 1 + .Machine$double.eps) is_greater_than(x, 1) is_greater_than_or_equal_to(x, 1) is_less_than(x, 1) is_less_than_or_equal_to(x, 1)
Documentation reproduced from package assertive.numbers, version 0.0-2, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.