format_p_value: Format p values (APA guideline)

Description Usage Arguments Value Examples

View source: R/format_p_value.R

Description

This function will round p values according to the APA guideline. It will try to round to two decimals where possible, and will try to avoid printing the value of alpha, see Examples.

Usage

1
format_p_value(p, alpha = 0.05, prepend_p = FALSE)

Arguments

p

p value(s) to transform

alpha

the value of alpha, defaults to 0.05

prepend_p

a logical to indicate whether "p =" should be prepended to the result

Value

A character

Examples

1
2
3
4
5
6
7
8
9
format_p_value(0.345678)
format_p_value(0.05125)

# this must not be "0.05", but is not "0.049" either,
# so it will add as many decimals as needed:
format_p_value(0.04993) 

format_p_value(c(0.123, 0.00000001))
format_p_value(c(0.123, 0.00000001), prepend_p = TRUE)

cleaner documentation built on June 13, 2021, 5:06 p.m.