Render complex tables in Rmarkdown

Is it possible to render complex tables like this one in rmarkdown?


I have never done one like that in RMarkdown but it should be possible. What output format are you using?

Have a look at the kableExtra package. It looks like it may help.

1 Like

I eventually arrived to the desired solution, using kableExtra.


text_tbl <- data.frame(
   a= c("1", "2","...","L",""),
   b= c("$O_{11}$","$O_{21}$","...","$O_{L1}$","$n_{.1}$"),
   c= c("$O_{11}$","$O_{22}$","...","$O_{L2}$","$n_{.2}$"),
   d= c("...","...","...","...","..."),
   e= c("$O_{C1}$","$O_{C2}$","...","$O_{LC}$","$n_{.C}$"),
   f= c("$n_{1.}$","$n_{2.}$","...","$n_{L.}$","$N$"))
kable(text_tbl, "html", booktabs = T, col.names = c("","1","2","...","C"," "), escape=F) %>%
  kable_styling(full_width = F,bootstrap_options = "striped") %>%
  add_header_above(c(" Variável A", "Variável B" = 4, " ")) %>%
  column_spec(1, bold = T) %>%


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.