powered by
These functions check whether the input fulfills the properties of a probability matrix.
check_probability_vector(x, len = NULL, tolerance = sqrt(.Machine$double.eps))assert_probability_vector( x, len = NULL, tolerance = sqrt(.Machine$double.eps), .var.name = checkmate::vname(x), add = NULL )test_probability_vector(x, len = NULL, tolerance = sqrt(.Machine$double.eps))
assert_probability_vector( x, len = NULL, tolerance = sqrt(.Machine$double.eps), .var.name = checkmate::vname(x), add = NULL )
test_probability_vector(x, len = NULL, tolerance = sqrt(.Machine$double.eps))
Same as documented in check_numeric.
check_numeric
[any] Object to check.
[integer(1)] Exact expected length of x.
integer(1)
x
[numeric(1)] A non-negative tolerance value.
numeric(1)
[character(1)] Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.
character(1)
vname
[AssertCollection] Collection to store assertion messages. See AssertCollection.
AssertCollection
Other vector helpers: check_numeric_vector(), chunk_vector(), insert_vector_entry(), map_indices(), match_numerics(), permutations(), split_vector_at(), subsets(), vector_occurrence()
check_numeric_vector()
chunk_vector()
insert_vector_entry()
map_indices()
match_numerics()
permutations()
split_vector_at()
subsets()
vector_occurrence()
p <- c(0.2, 0.3, 0.6) check_probability_vector(p) test_probability_vector(p) if (FALSE) { assert_probability_vector(p) }
Run the code above in your browser using DataLab