| add_header_footer {flextable} | R Documentation |
Add a single row of labels in the flextable's header or footer part. It can be inserted at the top or the bottom of the part.
add_header(x, top = TRUE, ...) add_footer(x, top = TRUE, ...)
x |
a |
top |
should the row be inserted at the top or the bottom. |
... |
a named list (names are data colnames) of strings specifying corresponding labels to add. |
ft <- flextable( head( iris ),
col_keys = c("Species", "Sepal.Length", "Petal.Length", "Sepal.Width", "Petal.Width") )
ft <- add_header(x = ft, Sepal.Length = "length",
Sepal.Width = "width", Petal.Length = "length",
Petal.Width = "width", Species = "Species", top = FALSE )
ft <- add_header(ft, Sepal.Length = "Inches",
Sepal.Width = "Inches", Petal.Length = "Inches",
Petal.Width = "Inches", Species = "Species", top = TRUE )
ft <- merge_h(ft, part = "header")
ft <- add_footer(ft, Species = "This is a footnote" )
ft <- merge_at(ft, j = 1:5, part = "footer")
ft