Description Usage Arguments Examples
Provide facilities for checking the layout of formulas. Use these with an input that is the value of a formula, that is, with a V binding rather than an E binding.
1 2 3 4 5 6 7 8 9 | formula_equals(F, target)
two_sided(F)
lhs_equals(F, ...)
rhs_equals(F, ...)
rhs_contains(F, ...)
|
F |
a formula from a student submission. |
target |
the desired attributes of the formula |
... |
expressions for the permissible parts of the formula |
1 2 3 4 5 6 7 8 9 10 11 | CODE <- for_checkr(quote({
data(mtcars, package = "datasets")
mod <- lm(mpg ~ hp * wt + cyl, data = mtcars)
}))
fa <- formula_arg(line_calling(CODE, lm),
failif(! two_sided(V), "Modeling formulas should have two sides."),
failif(! lhs_equals(V, mpg), "The response variable should be mileage."))
# or, another style for the same thing ...
check(formula_arg(line_calling(CODE, lm)),
failif(! two_sided(V), "Modeling formulas should have two sides."),
failif(! lhs_equals(V, mpg), "The response variable should be mileage."))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.