Change the display labels in the bottom row of the header.
Unlike set_header_df() which replaces the entire header structure,
this function only modifies column labels in the last header row.
Arguments
- x
a 'flextable' object, see flextable-package to learn how to create '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_lines(),
add_header_row(),
delete_columns(),
delete_part(),
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
Sepal length
Sepal width
Petal length
Petal width
Species
5.1
3.5
1.4
0.2
setosa
4.9
3.0
1.4
0.2
setosa
4.7
3.2
1.3
0.2
setosa
4.6
3.1
1.5
0.2
setosa
5.0
3.6
1.4
0.2
setosa
5.4
3.9
1.7
0.4
setosa
ft <- flextable(head(iris))
ft <- set_header_labels(
x = ft,
values = c(
"Sepal length",
"Sepal width", "Petal length",
"Petal width", "Species")
)
ft
Sepal length
Sepal width
Petal length
Petal width
Species
5.1
3.5
1.4
0.2
setosa
4.9
3.0
1.4
0.2
setosa
4.7
3.2
1.3
0.2
setosa
4.6
3.1
1.5
0.2
setosa
5.0
3.6
1.4
0.2
setosa
5.4
3.9
1.7
0.4
setosa
