format_p: Format a p-value according to APA standards

Description Usage Arguments Value Examples

View source: R/print_pvalue.R

Description

Format a p-value according to APA standards

Usage

1
format_p(pvalues, decimals = 3, numbers_only = FALSE)

Arguments

pvalues

The p-values

decimals

The number of decimals to be printed

numbers_only

Logical, indicates whether the p-values should be printed whithout the accompanying p. Defaults to FALSE.

Value

A string representation of the p value to be used in Rmarkdown documents.

Examples

1
2
3
4
5
6
7
8
9
# Format a p-value, default is 3 decimals
format_p(0.03123)
format_p(0.000001231)
format_p(0.000001231, decimals = 2)
format_p(0.3123, decimals = 2)
# Format several p-values with one function call
format_p(c(0.3123, 0.001, 0.00001, 0.19))
format_p(c(.999, .9999, 1))
format_p(c(0.3123, 0.001, 0.00001, 0.19, .99999), numbers_only = TRUE)

Alaburda/statistician documentation built on Jan. 8, 2021, 4:31 a.m.