View source: R/ard_stats_anova.R
ard_stats_anova | R Documentation |
Prepare ANOVA results from the stats::anova()
function.
Users may pass a pre-calculated stats::anova()
object or a list of
formulas. In the latter case, the models will be constructed using the
information passed and models will be passed to stats::anova()
.
ard_stats_anova(x, ...)
## S3 method for class 'anova'
ard_stats_anova(x, method_text = "ANOVA results from `stats::anova()`", ...)
## S3 method for class 'data.frame'
ard_stats_anova(
x,
formulas,
method,
method.args = list(),
package = "base",
method_text = "ANOVA results from `stats::anova()`",
...
)
x |
( |
... |
These dots are for future extensions and must be empty. |
method_text |
( |
formulas |
( |
method |
( |
method.args |
(named Note that this list may contain non-standard evaluation components.
If you are wrapping this function in other functions, the argument
must be passed in a way that does not evaluate the list, e.g.
using rlang's embrace operator |
package |
( |
When a list of formulas is supplied to ard_stats_anova()
, these formulas
along with information from other arguments, are used to construct models
and pass those models to stats::anova()
.
The models are constructed using rlang::exec()
, which is similar to do.call()
.
rlang::exec(.fn = method, formula = formula, data = data, !!!method.args)
The above function is executed in withr::with_namespace(package)
, which
allows for the use of ard_stats_anova(method)
from packages,
e.g. package = 'lme4'
must be specified when method = 'glmer'
.
See example below.
ARD data frame
anova(
lm(mpg ~ am, mtcars),
lm(mpg ~ am + hp, mtcars)
) |>
ard_stats_anova()
ard_stats_anova(
x = mtcars,
formulas = list(am ~ mpg, am ~ mpg + hp),
method = "glm",
method.args = list(family = binomial)
)
ard_stats_anova(
x = mtcars,
formulas = list(am ~ 1 + (1 | vs), am ~ mpg + (1 | vs)),
method = "glmer",
method.args = list(family = binomial),
package = "lme4"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.