set_formatter | R Documentation |
Apply formatter functions to column keys.
Functions should have a single argument (the vector) and should return the formatted values as a character vector.
set_formatter(x, ..., values = NULL, part = "body")
x |
a flextable object |
... |
Name-value pairs of functions, names should be existing col_key values |
values |
format functions, If values is supplied argument
|
part |
part of the table (one of 'body' or 'header' or 'footer') where to apply the formatter functions. |
Other cells formatters:
colformat_char()
,
colformat_date()
,
colformat_datetime()
,
colformat_double()
,
colformat_image()
,
colformat_int()
,
colformat_lgl()
,
colformat_num()
ft <- flextable(head(iris))
ft <- set_formatter(
x = ft,
Sepal.Length = function(x) sprintf("%.02f", x),
Sepal.Width = function(x) sprintf("%.04f", x)
)
ft <- theme_vanilla(ft)
ft
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.