tbl_pval: P-value rounding

Description Usage Arguments Value Examples

View source: R/tbl_pval.R

Description

In presenting p-values, journals are likely to request 2 decimal places for .99 >= p >= .01; 3 decimal places for .01 > p >= .001; and for smaller values express as "p<.001"

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tbl_pval(
  x,
  decimals_outer = 3L,
  decimals_inner = 2L,
  boundary_lo = 0.01,
  boundary_hi = 0.99,
  thresh_lo = 0.001,
  thresh_hi = 0.999,
  miss_replace = "--",
  drop_leading_zero = TRUE
)

Arguments

x

a vector of numeric values.

decimals_outer

number of decimals to print when p > thresh_hi or p < thresh_lo.

decimals_inner

number of decimals to print when thresh_lo < p < thresh_hi.

boundary_lo

the lower bound of the inner range.

boundary_hi

the upper bound of the inner range.

thresh_lo

the lowest value printed. Values lower than the threshold will be printed as <threshold.

thresh_hi

the highest value printed. Values higher than the threshold will be printed as >threshold.

miss_replace

a character value that replaces missing values.

drop_leading_zero

a logical value. If TRUE, the leading 0 is dropped for all p-values. So, '0.04' will become '.04'. If FALSE, no leading zeroes are dropped.

Value

a character vector

Examples

1
2
pvals <- c(0.00999, 0.01, 0.0052, 0.0011, 0.0001, 0.9, 0.999, 0.9999)
tbl_pval(pvals)

bcjaeger/tblStrings documentation built on Aug. 17, 2020, 9:36 a.m.