Learn R Programming

insight (version 0.14.1)

format_table: Parameter table formatting

Description

This functions takes a data frame with model parameters as input and formats certain columns into a more readable layout (like collapsing separate columns for lower and upper confidence interval values). Furthermore, column names are formatted as well. Note that format_table() converts all columns into character vectors!

Usage

format_table(
  x,
  pretty_names = TRUE,
  stars = FALSE,
  digits = 2,
  ci_width = "auto",
  ci_brackets = TRUE,
  ci_digits = 2,
  p_digits = 3,
  rope_digits = 2,
  zap_small = FALSE,
  preserve_attributes = FALSE,
  verbose = TRUE,
  ...
)

parameters_table( x, pretty_names = TRUE, stars = FALSE, digits = 2, ci_width = "auto", ci_brackets = TRUE, ci_digits = 2, p_digits = 3, rope_digits = 2, zap_small = FALSE, preserve_attributes = FALSE, verbose = TRUE, ... )

Arguments

x

A data frame of model's parameters, as returned by various functions of the easystats-packages. May also be a result from broom::tidy().

pretty_names

Return "pretty" (i.e. more human readable) parameter names.

stars

Add significance stars (e.g., p < .001***).

digits

Number of decimal places for numeric values (except confidence intervals and p-values).

ci_width

Minimum width of the returned string for confidence intervals. If not NULL and width is larger than the string's length, leading whitespaces are added to the string. If width="auto", width will be set to the length of the longest string.

ci_brackets

Logical, if TRUE (default), CI-values are encompassed in square brackets (else in parentheses).

ci_digits

Number of decimal places for confidence intervals.

p_digits

Number of decimal places for p-values. May also be "scientific" for scientific notation of p-values.

rope_digits

Number of decimal places for the ROPE percentage values.

zap_small

Logical, if TRUE, small values are rounded after digits decimal places. If FALSE, values with more decimal places than digits are printed in scientific notation.

preserve_attributes

Logical, if TRUE, preserves all attributes from the input data frame.

verbose

Toggle messages and warnings.

...

Arguments passed to or from other methods.

Value

A data frame. Note that format_table() converts all columns into character vectors!

See Also

Vignettes Formatting, printing and exporting tables and Formatting model parameters.

Examples

Run this code
# NOT RUN {
format_table(head(iris), digits = 1)

if (require("parameters")) {
  x <- model_parameters(lm(Sepal.Length ~ Species * Sepal.Width, data = iris))
  as.data.frame(format_table(x))
  as.data.frame(format_table(x, p_digits = "scientific"))
}
# }
# NOT RUN {
if (require("rstanarm") && require("parameters")) {
  model <- stan_glm(Sepal.Length ~ Species, data = iris, refresh = 0, seed = 123)
  x <- model_parameters(model, ci = c(0.69, 0.89, 0.95))
  as.data.frame(format_table(x))
}
# }

Run the code above in your browser using DataLab