0

I hope to create a datatable looking like the image, where some row headers span across multiple rows. One example for complex columns header are provided in this document, but I am unsure how to create a datatable with Rowspans. Does any one know how to do it?

The following is my attempt to create the table

numPeople = 6

sketch = htmltools::withTags(table(
      class = 'display',
      thead(
        tr(
          lapply(paste0(rep("Person", numPeople), c(1:numPeople)), th)
          ),
        tr(
          th(rowspan = 2, "fav"),
          th("color")
        ),
        tr(th("Fl")),
        tr(
          th(rowspan = 2, "least fav"),
          th("color")
        ),
        tr(th(
          "Flavor"
        ))
        )
    ))

enter image description here

Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
karyn-h
  • 133
  • 7
  • I think you can achieve this result by merging the cells, [as here](https://stackoverflow.com/a/56481354/1100107). – Stéphane Laurent Sep 12 '22 at 07:40
  • [Here](https://stackoverflow.com/questions/58834782/r-shiny-container-argument-in-renderdt-not-allowing-customisation-of-table/58835261#58835261) you can find another related example. – ismirsehregal Sep 13 '22 at 08:14

0 Answers0