str_humanize | R Documentation |
Improve readability for humans
str_humanize(x, ...)
## S3 method for class 'integer'
str_humanize(x, ...)
## S3 method for class 'numeric'
str_humanize(x, digits = NULL, tiny = NULL, zero = NULL, ...)
## S3 method for class 'tbl_df'
str_humanize(x, ...)
x |
an integer or numeric vector, or a |
... |
(unused) |
digits |
number of digits to retain |
tiny |
what to print in place of tiny values (that round to zero, given the number of digits you've specified) |
zero |
what to print in place of actual zeros (that are EXACTLY zero) |
str_humanize(integer)
: Do nothing to integers
str_humanize(numeric)
: Round real numbers to a given number of digits
str_humanize(tbl_df)
: Apply str_humanize(...)
to each column in turn
Per the help for round, the IEC 60559 ("round to the even digit") is used.
See help(round)
(look under the Details section).
x <- c(123456789.01, 0.996, 0.003, 0.007, 0.000001, 0)
str_humanize(x)
str_humanize(x, digits = 3)
str_humanize(x, digits = 3, tiny = "-")
str_humanize(x, digits = 2, tiny = "-", zero = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.