| labelizor | R Documentation |
labelizor() substitutes text values shown in a flextable
with human-readable labels. This is useful to turn column
values such as variable names, factor levels or coded strings
into presentation-ready wording (e.g. "Sepal.Length" to
"Sepal Length").
labels can be either a named character vector (names
identify values to find, values are the replacement labels)
or a function applied to every text chunk (e.g. toupper()).
Only the displayed content is affected; the underlying data of the flextable is unchanged.
labelizor(x, j = NULL, labels, part = "all")
x |
a 'flextable' object, see flextable-package to learn how to create 'flextable' object. |
j |
column selector, see section Column selection with the |
labels |
a named vector whose names will be used to identify values to replace and values will be used as labels. |
part |
part selector, see section Part selection with the |
mk_par(), append_chunks(), prepend_chunks()
Other functions to compose cell content:
append_chunks(),
as_paragraph(),
compose(),
footnote(),
prepend_chunks(),
void()
z <- summarizor(
x = CO2[-c(1, 4)],
by = "Treatment",
overall_label = "Overall"
)
ft_1 <- as_flextable(z, separate_with = "variable")
ft_1 <- labelizor(
x = ft_1, j = c("stat"),
labels = c(Missing = "Kouign amann")
)
ft_1 <- labelizor(
x = ft_1, j = c("variable"),
labels = toupper
)
ft_1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.