| lt_format | R Documentation |
Control the number of decimal places and thousands separator for numeric
columns. Columns passed to this function are excluded from automatic
formatting (see the auto_format argument of lt()). To disable auto-format
for a column without otherwise changing its display, call lt_format(x, ~col) with no other arguments.
lt_format(
x,
columns,
decimals = NULL,
big_mark = NULL,
percent = NULL,
prefix = NULL,
suffix = NULL
)
x |
An |
columns |
Character or integer vector of columns (or a one-sided formula). |
decimals |
Number of decimal places (default |
big_mark |
Thousands separator (e.g., |
percent |
If |
prefix |
String prepended to each formatted value (e.g., |
suffix |
String appended to each formatted value (e.g., |
x with the formatting recorded.
lt(head(mtcars)) |> lt_format(~ mpg + wt, decimals = 1, big_mark = ",")
d = data.frame(Item = c("A", "B"), Price = c(1234.5, 678.9))
lt(d) |> lt_format(~ Price, decimals = 2, big_mark = ",", prefix = "$")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.