Description Usage Arguments See Also Examples
Set predicates
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)
|
x |
Object to test. |
set |
Reference set (as a vector). |
Set operations, Property predicates
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.