pvalue: p-values formatter

pvalueR Documentation

p-values formatter

Description

Formatter for p-values, adding a symbol "<" for small p-values.

Usage

pvalue(x, accuracy = 0.001, decimal.mark = ".", prefix = NULL, add_p = FALSE)

label_pvalue(
  accuracy = 0.001,
  decimal.mark = ".",
  prefix = NULL,
  add_p = FALSE
)

Arguments

accuracy

A number to round to. Use (e.g.) 0.01 to show 2 decimal places of precision. If NULL, the default, uses a heuristic that should ensure breaks have the minimum number of digits needed to show the difference between adjacent values.

Applied to rescaled data.

decimal.mark

The character to be used to indicate the numeric decimal point.

prefix

A character vector of length 3 giving the prefixes to put in front of numbers. The default values are c("<", "", ">") if add_p is TRUE and c("p<", "p=", "p>") if FALSE.

add_p

Add "p=" before the value?

Value

label_pvalue returns a function with single parameter x, a numeric vector, that returns a character vector.

Examples

p <- c(.50, 0.12, .045, .011, .009, .00002, NA)
pvalue(p)
pvalue(p, accuracy = .01)
pvalue(p, add_p = TRUE)
custom_function <- label_pvalue(accuracy = .1, decimal.mark = ",")
custom_function(p)

larmarange/JLutils documentation built on March 24, 2023, 6:39 a.m.