Description Usage Arguments Value See Also Examples
Wraps around base::format()
and dplyr::mutate()
to format columns of a
tibble
or data.frame
. Note that any formatted columns will be converted
to character
mode, so use this function only for printing.
1 | format_cols(.data, .cols = NULL, ...)
|
.data |
A |
.cols |
< |
... |
Arguments passed on to |
An object of the same type as .data
with any formatted columns
converted to character
mode.
format
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Convert to tibble for better printing
mtcars_tbl <- tibble::as_tibble(mtcars)
## Formatting all columns
format_cols(mtcars_tbl, digits = 0)
## Specific columns
format_cols(mtcars_tbl, c("wt", "qsec"), digits = 0)
## Other formatting options
format_cols(mtcars_tbl, scientific = TRUE)
format_cols(mtcars_tbl, trim = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.