Takes a linear regression model object and summarizes it into a ready to export, human-readable summary table.
Usage
# S3 method for lm
build_table(
  .object,
  ...,
  .test = c("F", "Chisq"),
  .col.test = FALSE,
  .level = 0.95,
  .stat.pct.sign = TRUE,
  .digits = 1,
  .p.digits = 4
)Arguments
- .object
- An object of class - lm.
- ...
- One or more unquoted expressions separated by commas representing columns in the data.frame. May be specified using - tidyselect helpers. If left empty, all terms are summarized.
- .test
- A character. The name of the - stats::drop1test to use with the model. Supported options include the F-Test ('F') and Chi-squared Test ('Chisq').
- .col.test
- A logical. Append a columns for the test and accompanying statistic used to derive the p-value. 
- .level
- A double. The confidence level required. 
- .stat.pct.sign
- A logical. Paste a percent symbol after all reported frequencies. 
- .digits
- An integer. The number of digits to round numbers to. 
- .p.digits
- An integer. The number of p-value digits to report. Note that the p-value still rounded to the number of digits specified in - .digits.
Examples
library(dplyr)
data_mtcars <- datasets::mtcars |>
  mutate_at(vars('vs', 'am'), as.logical) |>
  mutate_at(vars('gear', 'carb', 'cyl'), as.factor)
fit <- lm(mpg ~ vs + drat + cyl, data = data_mtcars)
fit |> build_table()
#> # A tibble: 7 × 3
#>   Variable      `HR [CI]`         p       
#>   <chr>         <chr>             <chr>   
#> 1 "(Intercept)" "19.3 [4.1-34.6]" "0.0147"
#> 2 "vs"          "0 [-4.3-4.3]"    "0.9962"
#> 3 "drat"        "1.8 [-1.5-5.1]"  "0.2747"
#> 4 "cyl"         ""                ""      
#> 5 "   4"        "Reference"       ""      
#> 6 "   6"        "-6 [-10.1--2]"   "0.0051"
#> 7 "   8"        "-10 [-16.1--4]"  "0.0022"