at_most {checkthat} | R Documentation |
Facilitate "At Most" Comparison on Logical Vectors
Description
This function facilitates a comparison to check if at most a specified
proportion or count of values in a logical vector evaluate to TRUE
.
Usage
at_most(logical_vec, p = NULL, n = NULL, na.rm = FALSE)
Arguments
logical_vec |
A logical vector. |
p |
Proportion value (0 to 1) to compare against. |
n |
Count value (integer) to compare against. |
na.rm |
Logical. Should missing values be removed before calculation? |
Value
TRUE
if the condition is met for at most the specified
proportion or count, otherwise FALSE
.
See Also
Other basic_quantifiers:
at_least()
,
exactly_equal()
,
less_than()
,
more_than()
Examples
# Check if at most 20% of values are TRUE
at_most(c(TRUE, FALSE, TRUE, TRUE), p = 0.2) # Returns TRUE
[Package checkthat version 0.1.0 Index]