loading...

Create a rich-formatted {flextable} object with the table of coefficients from the summary() of a glm object.

# S3 method for class 'summary.glm'
tabularise_coef(
  data,
  header = TRUE,
  title = NULL,
  equation = header,
  auto.labs = TRUE,
  origdata = NULL,
  labs = NULL,
  lang = getOption("SciViews_lang", default = Sys.getenv("LANGUAGE", unset = "en")),
  show.signif.stars = getOption("show.signif.stars", TRUE),
  ...,
  kind = "ft",
  env = parent.frame()
)

Arguments

data

A summary.glm object

header

If TRUE (by default), add a header to the table

title

If TRUE, 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).

equation

If TRUE (by default), try to add a equation to the table header. The equation can also be passed in the form of a character string.

auto.labs

If TRUE (by default), use labels (and units) automatically from data or origdata=.

origdata

The original data set this model was fitted to. By default it is NULL and no label is used.

labs

Labels to change the names of elements in the term column of the table. By default it is NULL and nothing is changed.

lang

The natural language to use. The default value can be set with, e.g., options(SciViews_lang = "fr") for French.

show.signif.stars

If TRUE, add the significance stars to the table. The default is getOption("show.signif.stars")

...

Additional arguments

kind

The kind of table to produce: "tt" for tinytable, or "ft" for flextable (default).

env

The environment where to evaluate formulas (you probably do not need to change the default).

Value

A flextable object that you can print in different formats (HTML, LaTeX, Word, PowerPoint) or rearrange with the {flextable} functions.

Examples

iris_glm <- glm(data = iris, Petal.Length ~ Sepal.Length)
iris_glm_sum <- summary(iris_glm)
tabularise::tabularise_coef(iris_glm_sum)

Generalized Linear Model

Term

Estimate

Standard Error

t value

p value

Intercept

-7.10

0.5067

-14.0

< 2·10-16

Sepal.Length

1.86

0.0859

21.6

< 2·10-16

0 <= '***' < 0.001 < '**' < 0.01 < '*' < 0.05