Description Usage Arguments Value Author(s)
Sometimes (for example when illustrating differences), it can be useful for positive numbers to be prefixed by a + sign, just as negative numbers are with a - sign. The following are a few (very simple) wrapper functions which do this.
fmt_pm
Is a wrapper for round
,
which also paste
s a + sign before positive numbers
fmt_pc
A simple formatting function for percentages. Defaults to 0 decimal places
fmt_pc_pm
As above, but with a + prefix for positive numbers
format_nps
A very simple formatter for the Net Promoter Score
fmt_nps_pm
As above, but without the percentage sign
unsci
Unscientific notation: Short colloquial number formatting. For example, 1e+04 becomes "100k", 1.454e+09 becomes "1.5B", etc.
unsci_dollars
A convenience function for the above,
with currency = TRUE
as the default.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
x |
|
... |
Passed to |
type |
The truncation function for the number, in the context of the
text in which its likely to be formatted. One of |
digits |
Parameter passed to |
currency |
Should numbers be prefixed with |
symbol |
if |
pad |
Should the resulting strings be prefix-padded with spaces to make all strings in the character vector a uniform width? |
character
.
Brendan Rocks rocks.brendan@gmail.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.