
Tidy a model with broom (fallback: summary() coefficients)
Source: R/effects.R
morie_effects_tidy.RdThin extender over broom::tidy(). When broom is not
installed, falls back to building a tidy-style data frame from
summary(model)$coefficients, which is sufficient for the
core term / estimate / std.error / statistic / p.value columns
on the model classes (lm / glm) that rmorie ships.
Arguments
- model
A fitted model object.
- ...
Further arguments forwarded to
broom::tidy().
Examples
if (requireNamespace("broom", quietly = TRUE)) {
set.seed(1)
df <- data.frame(y = rnorm(60), x = rnorm(60), g = factor(rep(c("a", "b"), 30)))
fit <- stats::lm(y ~ x + g, data = df)
morie_effects_tidy(fit)
}
#> # A tibble: 3 × 5
#> term estimate std.error statistic p.value
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 (Intercept) 0.245 0.157 1.56 0.124
#> 2 x -0.0353 0.122 -0.288 0.774
#> 3 gb -0.267 0.222 -1.20 0.234