Description Usage Arguments Value Note Examples
Is x
equal/not equal/greater than/less than y
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 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))
|
x |
A numeric vector. |
y |
Another numeric vector, typically scalar or the same
length as |
tol |
Values within |
na_ignore |
A logical value. If |
severity |
How severe should the consequences of the assertion be?
Either |
.xname |
Not intended to be used directly. |
.yname |
Not intended to be used directly. |
TRUE
if the input x
is equal/not equal/greater
than/less than y
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.