Is x
equal to y
. powered by the all.equal()
function.
Usage
assert_equal(
x,
y,
tolerance = sqrt(.Machine$double.eps),
check_names = TRUE,
check_environment = TRUE,
check_tzone = TRUE,
msg = NULL,
call = rlang::caller_env(),
arg_name = NULL
)
Arguments
- x
An object to check
- y
The value to compare against
- tolerance
Differences smaller than tolerance are not reported. The default value is close to 1.5e-8 (numeric >= 0).
- check_names
should the names(.) of target and current should be compare (flag)
- check_environment
should the environments of functions should be compared? You may need to set check.environment=FALSE in unexpected cases, such as when comparing two nls() fits. (flag)
- check_tzone
should "tzone" attributes be compared. Important for comparing POSIXt objects. (flag)
- msg
A character string containing the error message to display if
x
is not equal toy
- call
Only relevant when pooling assertions into multi-assertion helper functions. See cli_abort for details.
- arg_name
Advanced use only. Name of the argument passed (default: NULL, will automatically extract arg_name).