Skip to contents

Given a model fit object (e.g. from lm() or glm()), tidy_coef() returns a tibble of coefficients.

Usage

tidy_coef(model, digit = integer(0), format = "%.3f")

Arguments

model

A character string specifying the model to be used.

digit

A positive integer specifying the number of digits to be displayed.

format

A character string specifying the format of the coefficients. The default is %.3f, which means three decimal places.

Value

Return the regression results as a list or a tibble.

See also

Examples

lm(mpg ~ wt + hp, data = mtcars) %>%
  tidy_coef()
#> # A tibble: 3 × 7
#>   term        coef                 estimate std.error statistic  p.value star 
#>   <chr>       <chr>                   <dbl>     <dbl>     <dbl>    <dbl> <chr>
#> 1 (Intercept) "37.227***\n(1.599)"  37.2      1.60        23.3  2.57e-20 ***  
#> 2 wt          "-3.878***\n(0.633)"  -3.88     0.633       -6.13 1.12e- 6 ***  
#> 3 hp          "-0.032**\n(0.009)"   -0.0318   0.00903     -3.52 1.45e- 3 **