Search code examples
rcenterkableextra

How to center text in a table drawn with kableextra?


does someone know how to center the text in the table?

Mod <- c("1","1b","2","2b","3 ","3b")
Lag <- c("1","1","1","1","1","1")



dt <- data.frame(cbind(Mod,Lag))
dt %>%
  kbl() %>%
  kable_classic(full_width = T, html_font = "Cambria")

enter image description here


Solution

  • Mod <- c("1","1b","2","2b","3 ","3b")
    Lag <- c("1","1","1","1","1","1")
    
    
    
    dt <- data.frame(cbind(Mod,Lag))
    dt %>%
      kbl() %>%
      kable_classic(full_width = T, html_font = "Cambria")%>%row_spec(0:6, align = "c")