In a table generated with kableExtra()
I would like to adjust the font face and background of the two top rows added with add_header_above()
.
The MWE provided below allows making adjustments to the top row of the original table. However, my goal is that
- the upper top row added has a bold font face and a colored background, and
- the lower top row added has an italic font face.
The table is included in a Rmarkdown document which is knitted both to PDF/LaTex and HTML.
MWE
mtcars[1:3,1:4] %>% kable() %>%
kable_styling(latex_options = c("striped", "scale_down")) %>%
# add column labels
add_header_above(c(" " = 1, "Features" = 2, "Features" = 2)) %>%
add_header_above(c(" " = 1, "Properties A" = 2, "Properties B" = 2)) %>%
# adjust font face and backgroun
row_spec(row = 0, italic = T) %>%
row_spec(row = 0, background = "orange")