Description Usage Arguments Value Examples
Format a numerical vector as a character vector holding the values formatted as percents. Will throw an error for non-numeric vetcors, and print a message if NA values are found.
1 | format_percent(vec, accuracy = 0.01, vec_names = names(vec), silent = FALSE)
|
vec |
Vector to format as a percent. |
accuracy |
The number to round to the nearest multiple of (e.g 3.14159 will round to 314.16% by default). The absolute value of this parameter will be used. The rounding will be done after conversion to a percent. |
vec_names |
Vector used to name the output. |
silent |
If |
Character vector of items formatted as percent.
1 2 3 4 5 | format_percent(0.12345)
format_percent(pi)
format_percent(0.1)
format_percent(0.12345, accuracy = 0.1)
format_percent(c(0.12345, 0.54321), vec_names = c("a", "b"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.