R and DT - Can you add row subheadings and groups to a datatable?
Asked Answered
T

1

7

Is it possible to group rows and add sub headings to datatables using the DT package in R?

The bellow example is done using a example in Javascript (https://datatables.net/examples/advanced_init/row_grouping.html).

enter image description here

Trilley answered 16/12, 2019 at 10:12 Comment(0)
A
11

From this question we can use RowGroup's extension as follows

library(DT)
datatable(iris,
          rownames = FALSE, 
          extensions = 'RowGroup', 
          options = list(rowGroup = list(dataSrc=c(4)),
                         columnDefs = list(list(visible=FALSE, targets=c(4)))
                         )
          )

enter image description here

Ambala answered 16/12, 2019 at 12:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.