formatcomma | R Documentation |
Wrapper for format()
making it easier to use with my typical settings
formatcomma(x, big.m = ",", nsmall = 2, drop0trailing = FALSE, ...)
x |
Numeric vector |
big.m |
Default is a comma at every three digits (1,000,000) |
nsmall |
Default is 2 digits after the decimal (3.14) |
drop0trailing |
Default is FALSE, which means zeroes after the last nonzero digit in the decimal portion are still shown (TRUE would mean 1.2 is shown, not 1.20) |
... |
other parameters passed to |
Same as format()
but with some preselected defaults
format()
cbind(mynum=formatcomma(c(1452345, 1.2, 4234.12345)))
cbind(mynum=formatcomma(c(1452345, 1.2, 4234.12345), drop0trailing=FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.