Skip to contents

satisfies() is an S7 generic that checks whether each row in a dataset is satisfied by an anchor's predicates, with methods available for the following classes:

Usage

satisfies(x, data)

## S7 method for class <kultarr::anchors>
satisfies(x, data)

Arguments

x

An object.

data

The dataframe to apply anchors on. Can be one instance or an entire dataset.

Value

A logical vector indicating whether the anchor is satisfied by each row of data.

Examples

# Construct two predicates.
pred_x <- predicate(
  feature = "x",
  operator = `>`,
  constant = 0.5
)

pred_y <- predicate(
  feature = "y",
  operator = `<`,
  constant = 0.8
)

# Combine predicates into an anchor.
anchor <- anchors(
  predicates = c(pred_x, pred_y)
)

data <- data.frame(
  x = c(0.2, 0.6, 0.7, 0.9),
  y = c(0.3, 0.5, 0.9, 0.7)
)

# Determine which observations satisfy all predicates.
satisfies(anchor, data)
#> [1] FALSE  TRUE FALSE  TRUE