tab_model()
creates HTML tables from regression models.
tab_model(..., transform, show.intercept = TRUE, show.est = TRUE, show.ci = 0.95, show.hdi50 = TRUE, 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.fstat = FALSE, show.aic = FALSE, show.aicc = FALSE, show.dev = FALSE, show.obs = TRUE, terms = NULL, rm.terms = NULL, group.terms = TRUE, order.terms = NULL, title = NULL, pred.labels = NULL, dv.labels = NULL, wrap.labels = 25, string.pred = "Predictors", string.std = "std. Beta", string.ci = "CI", string.se = "std. Error", string.p = "p", string.df = "df", string.stat = "Statistic", ci.hyphen = " – ", minus.sign = "-", collapse.ci = FALSE, collapse.se = FALSE, linebreak = TRUE, digits = 2, digits.p = 3, emph.p = TRUE, p.val = c("wald", "kr"), case = "parsed", auto.label = TRUE, bpe = "median", CSS = css_theme("regression"))
... | One or more regression models, including glm's or mixed models.
May also be a |
---|---|
transform | A character vector, naming a function that will be applied
on estimates and confidence intervals. By default, |
show.intercept | Logical, if |
show.est | Logical, if |
show.ci | Either logical, and if |
show.hdi50 | Logical, if |
show.se | Logical, if |
show.std | Indicates whether standardized beta-coefficients should also printed, and if yes, which type of standardization is done. See 'Details'. |
show.p | Logical, if |
show.stat | Logical, if |
show.df | Logical, if |
show.zeroinf | Logical, if |
show.r2 | Logical, if |
show.icc | Logical, if |
show.re.var | Logical, if |
show.fstat | Logical, if |
show.aic | Logical, if |
show.aicc | Logical, if |
show.dev | Logical, if |
show.obs | Logical, if |
terms | Character vector with names of those terms (variables) that should
be printed in the table. All other terms are removed from the output. If
|
rm.terms | Character vector with names that indicate which terms should
be removed from the output Counterpart to |
group.terms | Logical, if |
order.terms | Numeric vector, indicating in which order the coefficients should be plotted. See examples in this package-vignette. |
title | String, will be used as table caption. |
pred.labels | Character vector with labels of predictor variables.
If not |
dv.labels | Character vector with labels of dependent variables of all fitted models. See 'Examples'. |
wrap.labels | Numeric, determines how many chars of the value, variable or axis labels are displayed in one line and when a line break is inserted. |
string.pred | Character vector,used as headline for the predictor column.
Default is |
string.std | Character vector, used for the column heading of standardized beta coefficients. Default is |
string.ci | Character vector, used for the column heading of confidence interval values. Default is |
string.se | Character vector, used for the column heading of standard error values. Default is |
string.p | Character vector, used for the column heading of p values. Default is |
string.df | Character vector, used for the column heading of degrees of freedom. Default is |
string.stat | Character vector, used for the test statistic. Default is |
ci.hyphen | Character vector, indicating the hyphen for confidence interval range. May be an HTML entity. See 'Examples'. |
minus.sign | string, indicating the minus sign for negative numbers. May be an HTML entity. See 'Examples'. |
collapse.ci | Logical, if |
collapse.se | Logical, if |
linebreak | Logical, if |
digits | Amount of decimals for estimates |
digits.p | Amount of decimals for p-values |
emph.p | Logical, if |
p.val | Character, for mixed models, indicates how p-values are computed.
Use |
case | Desired target case. Labels will automatically converted into the
specified character case. See |
auto.label | Logical, if |
bpe | For Stan-models (fitted with the rstanarm- or
brms-package), the Bayesian point estimate is, by default, the median
of the posterior distribution. Use |
CSS | A |
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.
Standardized Estimates
Concerning the show.std
argument, show.std = "std"
will print normal standardized estimates. For show.std = "std2"
,
however, 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. This type
of standardization uses the standardize
-function
from the arm-package.
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 standardized estimats should not be printed.
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:
the class-names with "css."
-prefix as argument name and
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.
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 this package-vignette.