cleanNumberFormat: Convert a numeric vector to character with pretty formatting

Description Usage Arguments Value See Also Examples

View source: R/cleanNumberFormat.R

Description

cleanNumberFormat applies commonly used numeric formatting conventions to numeric vectors and returns them as character vectors

Usage

1
cleanNumberFormat(x, type, digits = 0)

Arguments

x

numeric vector to format

type

string describing the format type; valid values are "int", "dlr" and "pct"

digits

non-negative integer value indicating the number of decimal places to be used

Value

A character vector of formatted numbers.

See Also

round, format, trimws

Examples

1
2
3
4
5
x <- rnorm(5)
print(x)
cleanNumberFormat(x, "pct", 1)
cleanNumberFormat(x*10000, "int")
cleanNumberFormat(x*10000, "dlr", digits = 2)

dnegrey/miscTools documentation built on May 3, 2019, 2:57 p.m.