predicates-set: Set predicates

Description Usage Arguments See Also Examples

Description

Set predicates

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
chk_in(x, set)

chk_not_in(x, set)

chk_include(x, set)

chk_exclude(x, set)

chk_within(x, set)

chk_intersect(x, set)

chk_avoid(x, set)

chk_setequal(x, set)

Arguments

x

Object to test.

set

Reference set (as a vector).

See Also

Set operations, Property predicates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
s3methods <- function(x) {
  methods <- attr(methods(class = class(x)), "info")
  with(methods, generic[!isS4])
}
foo <- fasten(
  chk_include("predict", s3methods(object))
)(
  function(object, data) {
    pred <- predict(object, data)
    "Do something with prediction"
  }
)

mdl <- lm(mpg ~ wt, mtcars[1:10, ])
data <- mtcars[11:12, ]

foo(mdl, data)
## Not run: 
foo(NULL, data)
## End(Not run)

egnha/rong documentation built on May 7, 2019, 9:48 p.m.