frmt: format numbers with a set number of digits, including...

Description Usage Arguments Details Value Author(s) Examples

Description

This function is a wrapper for a call to formatC.

Usage

1
2
3
frmt(x, digits = getOption("qwraps.digits", 3), big.mark = ",")

frmtp(x, pdigits = getOption("qwraps.pdigits", 4), show.equal.sign = FALSE)

Arguments

x

vector of numbers to be formated.

digits

digits to follow the decimal mark, including trailing zeros. If x is an integer digits are set to 0.

big.mark

Default is a comma to separate, i.e., 1000 would be reported as 1,000.

pdigits

number of digits to report p-values to.

show.equal.sign

Details

Used to format numbers by both the end user and by several of the other functions in the qwraps package. frmt is intended for any numeric response frmtp for formating p-values.

Value

a string of formated numbers. Non-numbers are empty strings. If the p-value is less than 10^(-pdigits) the return will be '< 10^(-pdigits)

Author(s)

Peter DeWitt

Examples

1
2
3
4
5
6
7
x <- c(1.12, 1.231, 4.338, 10.4, 1.1, NA, pi, NaN, exp(1))
frmt(x, 2)
frmt(x, 3)
frmt(x*100, 3)

pvals <- c(0.000001, 0.12, 0.0001)
frmtp(pvals)

dewittpe/qwraps documentation built on May 15, 2019, 5:07 a.m.