write_p: Format a p-value for display

View source: R/write_p.R

write_pR Documentation

Format a p-value for display

Description

write_p formats a p-value for display in an RMarkdown document.

Usage

write_p(x, digits = 2)

Arguments

x

A length-1 numeric or a list-like object with element named p.value (such as an htest object)

digits

Number of digits to round to (default to 2)

Details

If x < 10^(-digits), then the result is the string p < 10^(-digits) in decimal notation.

Value

Returns a LaTeX-formatted string to report a p-value to the specified number of digits.

Examples

write_p(0.2345)

write_p(0.000234)

x = rnorm(10)
test1 = t.test(x)
write_p(test1)


tldr documentation built on May 31, 2023, 9:02 p.m.