empty_blanks | R Documentation |
blank columns are set as transparent. This is a shortcut function that will delete top and bottom borders, change background color to transparent, display empty content and set blank columns' width.
empty_blanks(x, width = 0.05, unit = "in", part = "all")
x |
a flextable object |
width |
width of blank columns (.1 inch by default). |
unit |
unit for width, one of "in", "cm", "mm". |
part |
partname of the table (one of 'all', 'body', 'header', 'footer') |
Other sugar functions for table style:
align()
,
bg()
,
bold()
,
color()
,
font()
,
fontsize()
,
highlight()
,
italic()
,
keep_with_next()
,
line_spacing()
,
padding()
,
rotate()
,
tab_settings()
,
valign()
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.