# NOT RUN {
ft_1 <- flextable(head(mtcars))
ft_1 <- bg(ft_1, bg = "wheat", part = "header")
ft_1 <- bg(ft_1, i = ~ qsec < 18, bg = "#EFEFEF", part = "body")
ft_1 <- bg(ft_1, j = "drat", bg = "#606060", part = "all")
ft_1 <- color(ft_1, j = "drat", color = "white", part = "all")
ft_1
if(require("scales")){
ft_2 <- flextable(head(iris))
colourer <- col_numeric(
palette = c("wheat", "red"),
domain = c(0, 7))
ft_2 <- bg(ft_2, j = c("Sepal.Length", "Sepal.Width",
"Petal.Length", "Petal.Width"),
bg = colourer, part = "body")
ft_2
}
# }
Run the code above in your browser using DataLab