Skip to contents

Thin 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.

Usage

morie_effects_tidy(model, ...)

Arguments

model

A fitted model object.

...

Further arguments forwarded to broom::tidy().

Value

A data frame with one row per model term.

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