formatInt( x, big.mark =",", trim =TRUE, forceInteger =TRUE, scientific =FALSE,...)
Arguments
x: numeric vector or matrix
big.mark, trim, scientific: passed to base::format() but configured with defaults intended for integer values:
big.mark="," adds comma between thousands.
trim=TRUE to trim excess whitespace.
scientific=FALSE to prevent exponential notation.
forceInteger: logical, default TRUE, whether to round numeric
to integer prior to calling base::format().
...: Additional arguments are ignored.
Returns
character vector if x is a vector, or if x is a matrix a matrix will be returned.
Details
This function is a quick wrapper function around base::format()
to display integer values as text strings. It will also return a matrix if the input is a matrix.
Examples
x <- c(1234,1234.56,1234567.89);## By default, commas are used for big.mark, and decimal values are hiddenformatInt(x);## By default, commas are used for big.markformatInt(x, forceInteger=FALSE);
See Also
Other jam string functions: asSize(), breaksByVector(), fillBlanks(), gsubOrdered(), gsubs(), makeNames(), nameVector(), nameVectorN(), padInteger(), padString(), pasteByRow(), pasteByRowOrdered(), sizeAsNum(), tcount(), ucfirst()