set_header_labels: Change headers labels

View source: R/augment_rows.R

set_header_labelsR Documentation

Change headers labels

Description

This function set labels for specified columns in the bottom row header of a flextable.

Usage

set_header_labels(x, ..., values = NULL)

Arguments

x

a flextable object

...

named arguments (names are data colnames), each element is a single character value specifying label to use.

values

a named list (names are data colnames), each element is a single character value specifying label to use. If provided, argument ... will be ignored. It can also be a unamed character vector, in that case, it must have the same length than the number of columns of the flextable.

See Also

Other functions for row and column operations in a flextable: add_body(), add_body_row(), add_footer(), add_footer_lines(), add_footer_row(), add_header(), add_header_row(), delete_columns(), delete_part(), delete_rows(), separate_header(), set_header_footer_df

Examples

ft <- flextable(head(iris))
ft <- set_header_labels(ft,
  Sepal.Length = "Sepal length",
  Sepal.Width = "Sepal width", Petal.Length = "Petal length",
  Petal.Width = "Petal width"
)

ft <- flextable(head(iris))
ft <- set_header_labels(ft,
  values = list(
    Sepal.Length = "Sepal length",
    Sepal.Width = "Sepal width",
    Petal.Length = "Petal length",
    Petal.Width = "Petal width"
  )
)
ft

ft <- flextable(head(iris))
ft <- set_header_labels(
  x = ft,
  values = c(
    "Sepal length",
    "Sepal width", "Petal length",
    "Petal width", "Species")
)
ft

flextable documentation built on Oct. 30, 2024, 9:15 a.m.