tab_model() creates HTML tables from regression models.

tab_model(
  ...,
  transform,
  show.intercept = TRUE,
  show.est = TRUE,
  show.ci = 0.95,
  show.ci50 = FALSE,
  show.se = NULL,
  show.std = NULL,
  show.p = TRUE,
  show.stat = FALSE,
  show.df = FALSE,
  show.zeroinf = TRUE,
  show.r2 = TRUE,
  show.icc = TRUE,
  show.re.var = TRUE,
  show.ngroups = TRUE,
  show.fstat = FALSE,
  show.aic = FALSE,
  show.aicc = FALSE,
  show.dev = FALSE,
  show.loglik = FALSE,
  show.obs = TRUE,
  show.reflvl = FALSE,
  terms = NULL,
  rm.terms = NULL,
  order.terms = NULL,
  keep = NULL,
  drop = NULL,
  title = NULL,
  pred.labels = NULL,
  dv.labels = NULL,
  wrap.labels = 25,
  bootstrap = FALSE,
  iterations = 1000,
  seed = NULL,
  robust = FALSE,
  vcov.fun = NULL,
  vcov.type = NULL,
  vcov.args = NULL,
  string.pred = "Predictors",
  string.est = "Estimate",
  string.std = "std. Beta",
  string.ci = "CI",
  string.se = "std. Error",
  string.std_se = "standardized std. Error",
  string.std_ci = "standardized CI",
  string.p = "p",
  string.std.p = "std. p",
  string.df = "df",
  string.stat = "Statistic",
  string.std.stat = "std. Statistic",
  string.resp = "Response",
  string.intercept = "(Intercept)",
  strings = NULL,
  ci.hyphen = " – ",
  minus.sign = "-",
  collapse.ci = FALSE,
  collapse.se = FALSE,
  linebreak = TRUE,
  col.order = c("est", "se", "std.est", "std.se", "ci", "std.ci", "ci.inner",
    "ci.outer", "stat", "std.stat", "p", "std.p", "df.error", "response.level"),
  digits = 2,
  digits.p = 3,
  digits.rsq = 3,
  digits.re = 2,
  emph.p = TRUE,
  p.val = NULL,
  df.method = NULL,
  p.style = c("numeric", "stars", "numeric_stars", "scientific", "scientific_stars"),
  p.threshold = c(0.05, 0.01, 0.001),
  p.adjust = NULL,
  case = "parsed",
  auto.label = TRUE,
  prefix.labels = c("none", "varname", "label"),
  bpe = "median",
  CSS = css_theme("regression"),
  file = NULL,
  use.viewer = TRUE,
  encoding = "UTF-8"
)

Arguments

Value

Invisibly returns

  • the web page style sheet (page.style),

  • the web page content (page.content),

  • the complete html-output (page.complete) and

  • the html-table with inline-css for use with knitr (knitr)

for further use.

Details

Standardized Estimates

Default standardization is done by completely refitting the model on the standardized data. Hence, this approach is equal to standardizing the variables before fitting the model, which is particularly recommended for complex models that include interactions or transformations (e.g., polynomial or spline terms). When show.std = "std2", standardization of estimates follows Gelman's (2008) suggestion, rescaling the estimates by dividing them by two standard deviations instead of just one. Resulting coefficients are then directly comparable for untransformed binary predictors. For backward compatibility reasons, show.std also may be a logical value; if TRUE, normal standardized estimates are printed (same effect as show.std = "std"). Use show.std = NULL (default) or show.std = FALSE, if no standardization is required.

How do I use CSS-argument?

With the CSS-argument, the visual appearance of the tables can be modified. To get an overview of all style-sheet-classnames that are used in this function, see return value page.style for details. Arguments for this list have following syntax:

  1. the class-names with "css."-prefix as argument name and

  2. each style-definition must end with a semicolon

You can add style information to the default styles by using a + (plus-sign) as initial character for the argument attributes. Examples:

  • css.table = 'border:2px solid red;' for a solid 2-pixel table border in red.

  • css.summary = 'font-weight:bold;' for a bold fontweight in the summary row.

  • css.lasttablerow = 'border-bottom: 1px dotted blue;' for a blue dotted border of the last table row.

  • css.colnames = '+color:green' to add green color formatting to column names.

  • css.arc = 'color:blue;' for a blue text color each 2nd row.

  • css.caption = '+color:red;' to add red font-color to the default table caption style.

Note

The HTML tables can either be saved as file and manually opened (use argument file) or they can be saved as temporary files and will be displayed in the RStudio Viewer pane (if working with RStudio) or opened with the default web browser. Displaying resp. opening a temporary file is the default behaviour (i.e. file = NULL).

Examples are shown in these three vignettes: Summary of Regression Models as HTML Table, Summary of Mixed Models as HTML Table and Summary of Bayesian Models as HTML Table.