labelizor {flextable}R Documentation

Change displayed labels

Description

The function replace text values in a flextable with labels. The labels are defined with character named vector.

The function is not written to be fast but to be handy. It does not replace the values in the underlying dataset but replace the defined content in the flextable (as defined with compose()).

Usage

labelizor(x, j = NULL, labels, part = "all")

Arguments

x

a flextable object

j

columns selection

labels

a named vector whose names will be used to identify values to replace and values will be used as labels.

part

partname of the table (one of 'all', 'body', 'header', 'footer')

See Also

mk_par(), append_chunks(), prepend_chunks()

Examples


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

[Package flextable version 0.9.6 Index]