check_range | R Documentation |
An argument x
is a numerical range if and only if (all conditions must be met):
Is an object of type: integer
or double
.
Is a vector or length two such that the value of the first number is not
less than the second number. Equalness is allowed if and only if unique
flag
is set to TRUE
.
Lower bound of the interval is greater than or equal to lower
and
upper bound of the interval is less than or equal to upper
.
It contains only finite (given that finite
is TRUE
) and non-missing values.
check_range(x, lower = -Inf, upper = Inf, finite = FALSE, unique = TRUE)
assert_range(
x,
lower = -Inf,
upper = Inf,
finite = FALSE,
unique = TRUE,
.var.name = checkmate::vname(x),
add = NULL
)
test_range(x, lower = -Inf, upper = Inf, finite = FALSE, unique = TRUE)
expect_range(
x,
lower = -Inf,
upper = Inf,
finite = FALSE,
unique = TRUE,
info = NULL,
label = vname(x)
)
x |
[any] |
lower |
[ |
upper |
[ |
finite |
[ |
unique |
[ |
.var.name |
[ |
add |
[ |
info |
[ |
label |
[ |
TRUE
if successful, otherwise a string with the error message.
assertions
for more details.
check_range(c(1, 5))
check_range(c(-5, 1))
check_range(c(4, 1))
check_range(c(1, 1))
check_range(c(1, 1), unique = FALSE)
check_range(1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.