50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

checkthat (version 0.1.0)

at_least: Facilitate "At Least" Comparison on Logical Vectors

Description

This function facilitates a comparison to check if at least a specified proportion or count of values in a logical vector evaluate to TRUE.

Usage

at_least(logical_vec, p = NULL, n = NULL, na.rm = FALSE)

Value

TRUE if the condition is met for at least the specified proportion or count, otherwise 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?

See Also

Other basic_quantifiers: at_most(), exactly_equal(), less_than(), more_than()

Examples

Run this code
# Check if at least 50% of values are TRUE
at_least(c(TRUE, TRUE, FALSE), p = 0.5) # Returns TRUE

Run the code above in your browser using DataLab