format_pval: Format p-value

View source: R/format_pval.R

format_pvalR Documentation

Format p-value

Description

This function was designed with formatting p-values, but it can be used to format any double to a desired number of decimal places, returning it as a character vector.

Usage

format_pval(p, digits = 3, zero = FALSE)

Arguments

p

One or more p-values as either a numeric vector or numeric variable in a data frame.

digits

How many digits to round to? Defaults to 3.

zero

Include 0 before decimal point? Default is FALSE

Value

A character vector of rounded p-values. Any p-values less than .001 are shown as "< .001"

Examples

p.value <- c(.01, .005, .00024)
format_pval(p.value)
format_pval(p.value, zero = TRUE)

sbw78/sbwtools documentation built on May 20, 2024, 9 a.m.