Skip to contents

This is an internal function called by format_stats(), which we recommend using instead.

Usage

format_chisq(
  x,
  digits = 1,
  pdigits = 3,
  pzero = FALSE,
  italics = TRUE,
  dfs = "par",
  type = "md"
)

Arguments

x

An htest object from cor.test(), t.test(), or wilcox.test().

digits

Number of digits after the decimal for means, confidence intervals, and test statistics.

pdigits

Number of digits after the decimal for p-values, ranging between 1-5 (also controls cutoff for small p-values).

pzero

Logical value (default = FALSE) for whether to include leading zero for p-values.

italics

Logical value (default = TRUE) for whether p label should be italicized.

dfs

Formatting for degrees of freedom ("par" = parenthetical, "sub" = subscript, "none" = do not print degrees of freedom).

type

Type of formatting ("md" = markdown, "latex" = LaTeX).

Value

A character string of statistical information formatted in Markdown or LaTeX.

Examples

format_stats(chisq.test(matrix(c(12, 5, 7, 7), ncol = 2)))
#> [1] "𝜒²(1) = 0.6, _p_ = .423"