Learn R Programming

vigicaen (version 0.15.5)

nice_p: Nice printing of p-values

Description

[Stable] Formatting function for consistent p-value reporting.

You can choose to print the leading zero (e.g. 0.01) or not (e.g. .01) with print_zero.

Usage

nice_p(p_val, print_zero = FALSE)

Value

A character vector with the formatted p-value(s)

Arguments

p_val

A numeric. The p-value to format.

print_zero

A logical. Should leading zero be printed? (see Details)

Examples

Run this code
pvals <-
  c(0.056548, 0.0002654, 0.816546, 0.0493321)
nice_p(pvals)

nice_p(pvals, print_zero = TRUE)

Run the code above in your browser using DataLab