Learn R Programming

inlmisc (version 0.5.5)

FormatPval: Format P Values

Description

Format p-values for pretty printing.

Usage

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.

See Also

ToScientific

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab