remove_ill_conditions: Remove invalid conditions from a list

View source: R/remove_ill_conditions.R

remove_ill_conditionsR Documentation

Remove invalid conditions from a list

Description

From a given list of character vectors, remove those elements that are not valid conditions.

Usage

remove_ill_conditions(x, data)

Arguments

x

A list of character vectors, each representing a condition.

data

A matrix or data frame whose column names define valid predicates.

Details

A valid condition is a character vector of predicates, where each predicate corresponds to a column name in the supplied data frame or matrix. Empty character vectors and NULL elements are also considered valid conditions.

This function acts as a simple filter around is_condition(). It checks each element of x against the column names of data and removes those that contain invalid predicates. The result preserves only valid conditions and discards the invalid ones.

Value

A list containing only those elements of x that are valid conditions.

Author(s)

Michal Burda

See Also

is_condition()

Examples

d <- data.frame(foo = 1:5, bar = 1:5, blah = 1:5)

conds <- list(c("foo", "bar"), "blah", "invalid", character(0), NULL)
remove_ill_conditions(conds, d)
# keeps "foo","bar"; "blah"; empty; NULL


nuggets documentation built on Nov. 5, 2025, 6:25 p.m.