R/tabularise.glm.R
tabularise_tidy.glm.Rd
Turn the tidy of glm object into a rich-formatted table with {flextable}. The table can be printed in different formats (HTML, LaTeX, Word, PowerPoint), or rearranged later on.
# S3 method for class 'glm'
tabularise_tidy(
data,
header = TRUE,
title = NULL,
equation = header,
auto.labs = TRUE,
origdata = NULL,
labs = NULL,
conf.int = FALSE,
conf.level = 0.95,
lang = getOption("SciViews_lang", default = Sys.getenv("LANGUAGE", unset = "en")),
show.signif.stars = getOption("show.signif.stars", TRUE),
...,
kind = "ft",
env = parent.frame()
)
A glm object
Logical. If TRUE
(TRUE
by default), a header is added to the table.
The header includes both the title and the equation (if applicable).
If set to FALSE
, neither the title nor the equation will be displayed in
the table header, even if the title
or equation
parameters are provided.
If TRUE
(TRUE
by default), add a title to the table header. Default to the same
value than header, except outside of a chunk where it is FALSE
if a table
caption is detected (tbl-cap
YAML entry).
Logical or character. Controls whether an equation is added to the table header and how parameters are used. Accepted values are:
TRUE
(default) : The equation is generated and added to the table
header. Its parameters are also used in the "Term" column.
FALSE
: No equation is generated or displayed, and its parameters are
not used in the "Term" column.
NA
: The equation is generated but not displayed in the table header.
Its parameters are used in the "Term" column.
Character string: A custom equation is provided directly and added to the table header.
If TRUE
(by default), use labels (and units) automatically
from data or origdata=
.
The original data set this model was fitted to. By default it
is NULL
and no label is used.
Labels to change the names of elements in the term
column of
the table. By default it is NULL
and nothing is changed.
If TRUE
, add the confidence interval. The default is
FALSE
.
The confidence level to use for the confidence interval if
conf.int = TRUE
. The default is 0.95.
The natural language to use. The default value can be set with,
e.g., options(SciViews_lang = "fr")
for French.
If TRUE
, add the significance stars to the table.
The default is getOption("show.signif.stars")
Additional arguments
The kind of table to produce: "tt" for tinytable, or "ft" for flextable (default).
The environment where to evaluate formulas (you probably do not need to change the default).
A flextable object is returned. You can print it in different formats (HTML, LaTeX, Word, PowerPoint), or rearrange it with the {flextable} functions.
#' # If the 'iris' dataset has labels and units, they can be used to enhance
# the output table
iris <- svBase::labelise(iris, self = FALSE, label = list(
Sepal.Length = "Length of the sepals",
Petal.Length = "Length of the petals",
Species = "Species"), units = c(rep("cm", 4), NA))
iris_glm <- glm(data = iris, Petal.Length ~ Sepal.Length)
tabularise::tabularise$tidy(iris_glm)
Generalized Linear Model
Term
Estimate
Standard Error
t value
p value
-7.10
0.5067
-14.0
< 2·10-16
***
1.86
0.0859
21.6
< 2·10-16
***
0 <= '***' < 0.001 < '**' < 0.01 < '*' < 0.05
tabularise::tabularise$tidy(iris_glm, conf.int = TRUE)
Generalized Linear Model
Term
Estimate
Lower bound (CI)
Upper bound (CI)
Standard Error
t value
p value
-7.10
-8.09
-6.11
0.5067
-14.0
< 2·10-16
***
1.86
1.69
2.03
0.0859
21.6
< 2·10-16
***
0 <= '***' < 0.001 < '**' < 0.01 < '*' < 0.05
tabularise::tabularise$tidy(iris_glm, conf.int = TRUE, equation = NA)
Generalized Linear Model
Term
Estimate
Lower bound (CI)
Upper bound (CI)
Standard Error
t value
p value
-7.10
-8.09
-6.11
0.5067
-14.0
< 2·10-16
***
1.86
1.69
2.03
0.0859
21.6
< 2·10-16
***
0 <= '***' < 0.001 < '**' < 0.01 < '*' < 0.05