library(flextable)
ft01 <- fp_text_default(color = "red")
ft02 <- fp_text_default(color = "orange")
pars <- as_paragraph(
as_chunk(c("(1)", "(2)"), props = ft02), " ",
as_chunk(c("My tailor is rich",
"My baker is rich"), props = ft01)
)
ft_1 <- flextable(head(mtcars))
ft_1 <- add_header_row(ft_1, values = pars,
colwidths = c(5, 6), top = FALSE)
ft_1 <- add_header_row(ft_1, values = pars,
colwidths = c(3, 8), top = TRUE)
ft_1
ft_2 <- flextable(head(airquality))
ft_2 <- add_header_row(ft_2, values = c("Measure", "Time"),
colwidths = c(4, 2), top = TRUE)
ft_2 <- theme_box(ft_2)
ft_2
Run the code above in your browser using DataLab