loading...

Create a rich-formatted table with the 'glance' information from an lm object.

# S3 method for class 'lm'
tabularise_glance(
  data,
  header = TRUE,
  title = header,
  equation = header,
  auto.labs = TRUE,
  origdata = NULL,
  labs = NULL,
  lang = getOption("SciViews_lang", "en"),
  ...,
  kind = "ft"
)

Arguments

data

An lm object

header

Logical. If TRUE (TRUEby 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.

title

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

equation

Logical or character. Controls whether an equation is added to the table header and how parameters are used. Accepted values are:

  • TRUE(by 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.

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 (only the name of the variables).

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.

...

Additional arguments passed to equatiomatic::equation()

kind

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

Value

A flextable object that you can print in different form or rearrange with the {flextable} functions.

Examples

iris_lm <- lm(data = iris, Petal.Length ~ Sepal.Length)
tabularise::tabularise$glance(iris_lm)

Linear model

Petal.Length=α+β(Sepal.Length)+ϵ\operatorname{Petal.Length} = \alpha + \beta_{}(\operatorname{Sepal.Length}) + \epsilon

R2

Adj.R2

RSE

t value

p value

Model df

Log-likelihood

AIC

BIC

Deviance

Residuals df

N

0.76

0.758

0.868

469

< 2·10-16

1

-191

387

396

111

148

150