set_header_labels() renames individual column labels in the bottom header row. set_header_df() and set_footer_df() rebuild the entire header or footer from a mapping data frame.
set_header_labels()
Change the display labels in the bottom row of the header.A
flextable object.Named arguments where names are data column names and values are the replacement label strings.
Alternative to
.... A named list (column name to label), or an unnamed character vector with the same length as the number of columns. If supplied, ... is ignored.Examples
Using named arguments:values list:
set_header_df()
Replace all header rows using a mapping data frame. Unlikeset_header_labels() which modifies only the bottom header row, this function rebuilds the entire header structure.
The data frame must contain one column whose values match the flextable col_keys. This column is used as the join key. The remaining columns become header rows — the leftmost column maps to the top header row and the rightmost to the bottom.
A
flextable object.A data frame specifying header content per column. One column must match
col_keys; all others become header rows.Name of the column in
mapping used to join with the flextable column keys.Example
set_footer_df()
Replace all footer rows using a mapping data frame. Works identically toset_header_df() but targets the footer.
A
flextable object.A data frame specifying footer content per column.
Name of the column in
mapping used to join with the flextable column keys.Example
Return value
All functions return the modifiedflextable object.
See also
add_header_row()— add spanning header rowsadd_header_lines()— add full-width header linesseparate_header()— split compound column names into rowsmerge_h(),merge_v()— merge header cells afterset_header_df()