# NOT RUN {
typology <- data.frame(
col_keys = c( "Sepal.Length", "Sepal.Width", "Petal.Length",
"Petal.Width", "Species" ),
what = c("Sepal", "Sepal", "Petal", "Petal", " "),
measure = c("Length", "Width", "Length", "Width", "Species"),
stringsAsFactors = FALSE )
typology
ftab <- flextable(head(iris), col_keys = c("Species",
"break1", "Sepal.Length", "Sepal.Width",
"break2", "Petal.Length", "Petal.Width") )
ftab <- set_header_df(ftab, mapping = typology, key = "col_keys" )
ftab <- merge_h(ftab, part = "header")
ftab <- theme_vanilla(ftab)
ftab <- empty_blanks(ftab)
ftab <- width(ftab, j = c(2, 5), width = .1 )
ftab
# }
Run the code above in your browser using DataLab