formatP: A handy function for formatting p-values to nice percents for...

View source: R/formatting.R

formatPR Documentation

A handy function for formatting p-values to nice percents for publication

Description

...

Usage

formatP(p, min.sig = 0.001, max.sig = 99.99, sig.digs = 3)

Arguments

p

A single number with p-values to be formatted.

min.sig, max.sig

Numbers in (0, 100) defining when function should return a thing like '<0.01%' or '>99.99%' instead of number. By default 0.001 and 99.99.

sig.digs

A number of significant digits to show. By default 3.

Details

TODO: Allow vectorized input TODO: Add a way to automatically format them in APA/NEJM formats TODO: Add a way to skip a trailing 0 and add p/P in the beginning TODO: Add option to sanitize input

Value

A character vector with p-values formatted in a nice way

See Also

Other publishing-formatting: formatOR(), signif_sym()

Examples

formatP(0.0026485635335) # -> "0.265%"
formatP(5e-33) # -> "<0.001%"

JantekM/JantoTools documentation built on Jan. 31, 2023, 1:28 p.m.