This is a thin wrapper around format.pval() that guarantees fixed
(not scientific) notation, links (by default) the eps argument to
the digits argument and vice versa, and sets nsmall to equal
digits.
Arguments
- pv, digits, eps, na.form, ...
see
format.pval().
Examples
pvs <- 10^((0:-12)/2)
# Jointly:
fpf <- fixed.pval(pvs, digits = 3)
fpf
#> [1] "1.000" "0.316" "0.100" "0.032" "0.010" "0.003" "0.001" "<0.001"
#> [9] "<0.001" "<0.001" "<0.001" "<0.001" "<0.001"
format.pval(pvs, digits = 3) # compare
#> [1] "1.000000" "0.316228" "0.100000" "0.031623" "0.010000" "0.003162"
#> [7] "0.001000" "0.000316" "0.000100" "3.16e-05" "1.00e-05" "3.16e-06"
#> [13] "1.00e-06"
# Individually:
fpf <- sapply(pvs, fixed.pval, digits = 3)
fpf
#> [1] "1.000" "0.316" "0.100" "0.032" "0.010" "0.003" "0.001" "<0.001"
#> [9] "<0.001" "<0.001" "<0.001" "<0.001" "<0.001"
sapply(pvs, format.pval, digits = 3) # compare
#> [1] "1" "0.316" "0.1" "0.0316" "0.01" "0.00316"
#> [7] "0.001" "0.000316" "1e-04" "3.16e-05" "1e-05" "3.16e-06"
#> [13] "1e-06"
# Control eps:
fpf <- sapply(pvs, fixed.pval, eps = 1e-3)
fpf
#> [1] "1.000" "0.316" "0.100" "0.032" "0.010" "0.003" "0.001" "<0.001"
#> [9] "<0.001" "<0.001" "<0.001" "<0.001" "<0.001"