Apply both generics::tidy()
and generics::glance()
to an object and
return a single tibble with both sets of information.
An object to be converted into a tidy tibble.
Additional arguments passed to generics::tidy()
and generics::glance()
.
Arguments are passed to both methods, but should be ignored by the
inapplicable method. For example, if called on an lm object,
conf.int
will affect generics::tidy()
but not generics::glance()
.
A list of additional arguments passed only
to generics::tidy()
.
A list of additional arguments passed only
to generics::glance()
.
A tibble with columns and rows from
generics::tidy()
and columns of repeated rows
from generics::glance()
.
Column names that appear in both the tidy
data and glance
data will be
disambiguated by appending "model.
" to the glance
column names.
mod <- lm(mpg ~ wt + qsec, data = mtcars)
tidy_glance(mod)
#> # A tibble: 3 × 17
#> term estim…¹ std.e…² stati…³ p.value r.squ…⁴ adj.r…⁵ sigma model…⁶ model.…⁷
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 (Inte… 19.7 5.25 3.76 7.65e- 4 0.826 0.814 2.60 69.0 9.39e-12
#> 2 wt -5.05 0.484 -10.4 2.52e-11 0.826 0.814 2.60 69.0 9.39e-12
#> 3 qsec 0.929 0.265 3.51 1.50e- 3 0.826 0.814 2.60 69.0 9.39e-12
#> # … with 7 more variables: df <dbl>, logLik <dbl>, AIC <dbl>, BIC <dbl>,
#> # deviance <dbl>, df.residual <int>, nobs <int>, and abbreviated variable
#> # names ¹estimate, ²std.error, ³statistic, ⁴r.squared, ⁵adj.r.squared,
#> # ⁶model.statistic, ⁷model.p.value
tidy_glance(mod, conf.int = TRUE)
#> # A tibble: 3 × 19
#> term estim…¹ std.e…² stati…³ p.value conf.…⁴ conf.…⁵ r.squ…⁶ adj.r…⁷ sigma
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 (Inter… 19.7 5.25 3.76 7.65e- 4 9.00 30.5 0.826 0.814 2.60
#> 2 wt -5.05 0.484 -10.4 2.52e-11 -6.04 -4.06 0.826 0.814 2.60
#> 3 qsec 0.929 0.265 3.51 1.50e- 3 0.387 1.47 0.826 0.814 2.60
#> # … with 9 more variables: model.statistic <dbl>, model.p.value <dbl>,
#> # df <dbl>, logLik <dbl>, AIC <dbl>, BIC <dbl>, deviance <dbl>,
#> # df.residual <int>, nobs <int>, and abbreviated variable names ¹estimate,
#> # ²std.error, ³statistic, ⁴conf.low, ⁵conf.high, ⁶r.squared, ⁷adj.r.squared
tidy_glance(mod, tidy_args = list(conf.int = TRUE))
#> # A tibble: 3 × 19
#> term estim…¹ std.e…² stati…³ p.value conf.…⁴ conf.…⁵ r.squ…⁶ adj.r…⁷ sigma
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 (Inter… 19.7 5.25 3.76 7.65e- 4 9.00 30.5 0.826 0.814 2.60
#> 2 wt -5.05 0.484 -10.4 2.52e-11 -6.04 -4.06 0.826 0.814 2.60
#> 3 qsec 0.929 0.265 3.51 1.50e- 3 0.387 1.47 0.826 0.814 2.60
#> # … with 9 more variables: model.statistic <dbl>, model.p.value <dbl>,
#> # df <dbl>, logLik <dbl>, AIC <dbl>, BIC <dbl>, deviance <dbl>,
#> # df.residual <int>, nobs <int>, and abbreviated variable names ¹estimate,
#> # ²std.error, ³statistic, ⁴conf.low, ⁵conf.high, ⁶r.squared, ⁷adj.r.squared