Skip to contents

A valid condition is a character vector of predicates, where each predicate corresponds to some column name of the related data frame. This function checks whether the given list of character vectors x contains only such predicates that can be found in column names of given data frame data.

Usage

is_condition(x, data)

Arguments

x

a list of character vector

data

a matrix or a data frame

Value

a logical vector indicating whether each element of the list x contains a character vector such that all elements of that vector are column names of data

Details

Note that empty character vector is considered as a valid condition too.

Author

Michal Burda

Examples

d <- data.frame(foo = 1:5, bar = 1:5, blah = 1:5)
is_condition(list("foo"), d)
#> [1] TRUE
is_condition(list(c("bar", "blah"), NULL, c("foo", "bzz")), d)
#> [1]  TRUE  TRUE FALSE