Description Usage Arguments Value Examples
View source: R/format_number.R
Formats numeric vectors, rounding values to a reasonable amount of digits, and inserting separators for large numbers. Useful for inserting inline numeric values in R Markdown.
1 | format_number(x, round_digits = c(3, 2, 1, 0), large_num_sep = ",")
|
x |
A numeric vector |
round_digits |
The number of digits to round numbers at each cutoff (< 1, < 10, < 100, >= 100). Default value is 3, 2, 1, 0. |
large_num_sep |
A character to separate every three digits in large numbers. Default value is the American standard of using a comma (","). |
A character vector
1 2 | format_number(pi * c(0.1, 1, 10, 100, 1000))
"0.314" "3.14" "31.4" "314" "3,142"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.