FormatPval: Format P Values

Description Usage Arguments Value Author(s) See Also Examples

View source: R/FormatPval.R

Description

Format p-values for pretty printing.

Usage

1
2
3
4
5
6
7
FormatPval(
  x,
  digits = max(1, getOption("digits") - 2),
  eps = .Machine$double.eps,
  na.form = "NA",
  scientific = NA
)

Arguments

x

'numeric' vector. p-values

digits

'integer' count. Number of significant digits to be used.

eps

'numeric' number. Numerical tolerance, values less than eps are formatted as "< [eps]".

na.form

'character' string. Value used for missing values.

scientific

'logical' flag. Whether values should be encoded in scientific format using LaTeX notation. A missing value lets R decide whether fixed or scientific notation is used.

Value

A 'character' vector of formatted p-values.

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center

See Also

ToScientific

Examples

1
2
3
4
5
6
7
x <- c(stats::runif(5), pi^-100, NA)
FormatPval(x)
format.pval(x)

x <- c(0.1, 0.0001, 1e-27)
FormatPval(x, scientific = TRUE)
FormatPval(x, digits = 3, eps = 0.001)

inlmisc documentation built on Jan. 25, 2022, 1:14 a.m.