I have the following table created using kableExtra
. I'm looking for a way in which I can add a vertical border between columns c and d (to seperate the content under the two headers.) Also, is there a way to change the color of the cells in an entire column (lets say the third column?)
library(dplyr)
library(kableExtra)
a <- c('First', 'Second', 'Third')
b <- c(1,2,3)
c <- c(4,5,6)
d <- c(7,8,9)
e <- c(10,11,12)
df <- data.frame(a,b,c,d,e)
kable(df) %>%
kable_styling() %>%
add_header_above(c("","Header 1" = 2, "Header 2" = 2), bold = T)
Try:
kable(df) |>
kable_styling() |>
add_header_above(c("", "Header 1" = 2, "Header 2" = 2), bold = TRUE) |>
column_spec(4, border_left = TRUE) |>
column_spec(3, background = "lightgreen")