These functions check whether the input fulfills the properties of a probability matrix.
Arguments
- x
[any]
Object to check.- len
[
integer(1)]
Exact expected length ofx.- tolerance
[
numeric(1)]
A non-negative tolerance value.- .var.name
[
character(1)]
Name of the checked object to print in assertions. Defaults to the heuristic implemented invname.- add
[
AssertCollection]
Collection to store assertion messages. SeeAssertCollection.
Value
Same as documented in check_numeric.
See also
Other vector helpers:
check_numeric_vector(),
chunk_vector(),
equidistant_vectors(),
insert_vector_entry(),
map_indices(),
match_numerics(),
permutations(),
split_vector_at(),
subsets(),
vector_occurrence()
Examples
p <- c(0.2, 0.3, 0.6)
check_probability_vector(p)
#> [1] "Must add up to 1"
test_probability_vector(p)
#> [1] FALSE
if (FALSE) { # \dontrun{
assert_probability_vector(p)
} # }
