prettifyPValue: Clean p-values for tabulation and publication

Description Usage Arguments Examples

View source: R/prettifyPValues.R

Description

This is a small vectorised wrapper to convert pvalues to a significant number of decimal places and replace those less than that with a less than symbol, e.g. to two decimal places 0.007 will return <0.01, but to three it will return 0.007. it also utilises round with zero to keep trailing zeros. This is important for p-values because it shows the accuracy you have reported.

Usage

1
prettifyPValue(pvalue, digits = 3, signif = NULL)

Arguments

pvalue

A value or vector of numerical pvalues

digits

The number of digits to report to the right of the decimal place

signif

optional parameter. Adds a star to those values less than the value of signif to highlight significant results.

Examples

1
2
3
4
5
pvalues = c(0.1257,0.0675,0.0345,0.0016,0.0009)
# Two decimal places
prettifyPValue(pvalues, digits=2)
# Three decimal places with a star for those less than 0.05
prettifyPValue(pvalues, digits=3, signif=0.05)

csmoxford/prettyTables documentation built on May 14, 2019, 12:24 p.m.