Create multi level headers

This vignette introduces how to create multi level headers.

  collapse = TRUE,
  comment = "#>",
  eval = "dplyr" %in% rownames(installed.packages())

Prepare flextable

ft <- iris[1:2, ] %>% as_flextable

Separate headers

The separate_header() function generates multi-level headers by separating original headers (row names) by delimiters.

ft %>% separate_header()

The sep argument defines delimiters by regular expression. The default delimiters are . and _. Let's see what happens when seop = "e"

ft %>% separate_header(sep = "e")

Span headers

The span_header() function also generates multi-level headers. Unlike the separate_header() function, the span_header() function merges adjacent headers if they have same values.

ft %>% span_header()

Try the ftExtra package in your browser

Any scripts or data that you put into this service are public.

ftExtra documentation built on Jan. 4, 2022, 5:07 p.m.