| check_equal | R Documentation |
Elements of
... must be numeric vectors or scalars.
This function performs an element-by-element comparison of the first object
provided in ... with every other object in ... and returns TRUE if all
comparisons are equal within a given tolerance and FALSE otherwise.
Elements of
... must be numeric vectors or scalars.
This function performs an element-by-element comparison of the first object
provided in ... with every other object in ... and throws an error if they
are not.
check_equal(..., tol = sqrt(.Machine$double.eps))
assert_equal(
...,
tol = sqrt(.Machine$double.eps),
.var.name = vname(x),
add = NULL
)
... |
( |
tol |
( |
.var.name |
[ |
add |
[ |
TRUE if all element-by-element differences are less than tolerance
in magnitude, FALSE otherwise.
list(...), invisibly.
If there are any missing or infinite values in ..., this function
returns FALSE, regardless of the values of other elements in ....
If elements in ... are not all of the same length, FALSE is returned.
If there are any missing or infinite values in ..., this function
throws an error, regardless of the values of other elements in ....
If elements in ... are not all of the same length, an error is thrown.
assertions for more details.
assertions for more details.
check_equal(1:2, 1:2) # TRUE
check_equal(1:2, 2:3) # "Not all equal"
check_equal(Inf, Inf) # "Not all equal"
check_equal(0.01, 0.02) # "Not all equal"
check_equal(0.01, 0.02, tol = 0.05) # TRUE
check_equal(1, c(1, 1)) # "Not all equal"
assert_equal(1:2, 1:2) # no error
assert_equal(0.01, 0.02, tol = 0.05) # no error
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.