Skip to contents
loading...

This function extracts and formats the table of coefficients from a summary.nls object, similar to stats::coef(), but in flextable object.

Usage

# S3 method for summary.nls
tabularise_coef(
  data,
  header = TRUE,
  title = NULL,
  equation = header,
  lang = getOption("data.io_lang", "en"),
  show.signif.stars = getOption("show.signif.stars", TRUE),
  ...,
  kind = "ft",
  env = parent.frame()
)

Arguments

data

A summary.nls object.

header

If TRUE (by default), add a title 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

Add equation of the model to the table. If TRUE, equation() is used. The equation can also be passed in the form of a character string (LaTeX equation).

lang

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

show.signif.stars

If TRUE (by default), add the significance stars to the table.

...

Additional arguments passed to equation()

kind

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

env

The environment where to evaluate lazyeval expressions (unused for now).

Value

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

Examples

data("ChickWeight", package = "datasets")
chick1 <- ChickWeight[ChickWeight$Chick == 1, ]
# Adjust a logistic curve
chick1_logis <- nls(data = chick1, weight ~ SSlogis(Time, Asym, xmid, scal))
chick1_logis_sum <- summary(chick1_logis)

tabularise::tabularise$coef(chick1_logis_sum)

Nonlinear least squares logistic model

NA

Term

Estimate

Standard Error

tobs. value

p value

Asym

937.0

465.868

2.01

7.52·10-02

.

xmid

35.2

8.312

4.24

2.18·10-03

**

scal

11.4

0.905

12.60

5.08·10-07

***

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

tabularise::tabularise$coef(chick1_logis_sum, header = FALSE, equation = TRUE)

Term

Estimate

Standard Error

tobs. value

p value

Asym

937.0

465.868

2.01

7.52·10-02

.

xmid

35.2

8.312

4.24

2.18·10-03

**

scal

11.4

0.905

12.60

5.08·10-07

***

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