check_probabilities | R Documentation |
Check if every element in a given numerical vector or matrix represents a probability, that is a number within (0, 1) interval, that can optionally be closed at any side.
check_probabilities(
x,
bounds_closed = TRUE,
len = NULL,
unique = FALSE,
sorted = FALSE
)
assert_probabilities(
x,
bounds_closed = TRUE,
len = NULL,
unique = FALSE,
sorted = FALSE,
.var.name = checkmate::vname(x),
add = NULL
)
test_probabilities(
x,
bounds_closed = TRUE,
len = NULL,
unique = FALSE,
sorted = FALSE
)
expect_probabilities(
x,
bounds_closed = TRUE,
len = NULL,
unique = FALSE,
sorted = FALSE,
info = NULL,
label = vname(x)
)
x |
( |
bounds_closed |
( |
len |
[ |
unique |
[ |
sorted |
[ |
.var.name |
[ |
add |
[ |
info |
[ |
label |
[ |
TRUE
if successful, otherwise a string with the error message.
If there are any missing or non-finite values in x
, this function
returns FALSE
, regardless of the values of other elements in x
.
assertions
for more details.
x <- c(0, 0.2, 0.1, 0.3, 1)
check_probabilities(x)
check_probabilities(x, bounds_closed = FALSE)
check_probabilities(x, bounds_closed = c(FALSE, TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.