Description Usage Arguments Examples
View source: R/format_numbers.R
Function formats numeric columns only. Other classes are left intact.
1 | format_numbers(data, digits = 3, format = "f", fun = formatC, ...)
|
data |
A data frame. |
digits |
(numeric or |
format |
(character) |
fun |
A function that does the formatting.
Default is |
... |
Other parameters to be passed to |
1 2 3 4 5 6 7 8 9 10 11 | library(biostat)
DATA <- head(iris)
# The same rounding for each column
format_numbers(DATA, 2)
# Different rounding for different columns
format_numbers(DATA, c(2, 2, 3, 3, NA))
# Use `NA` to leave a column unformatted
format_numbers(DATA, c(4, NA, 3, NA, NA))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.