datatable(head(mtcars), rownames =FALSE) # no row names
Custom table container
View code
# a custom table containersketch = htmltools::withTags(table(class ='display',thead(tr(th(rowspan =2, 'Species'),th(colspan =2, 'Sepal'),th(colspan =2, 'Petal') ),tr(lapply(rep(c('Length', 'Width'), 2), th) ) )))# use rownames = FALSE here because we did not generate a cell for row names in# the header, and the header only contains five columnsdatatable(iris[1:20, c(5, 1:4)], container = sketch, rownames =FALSE)
HTML
As always, you can include raw HTML in a Quarto document, and it will be rendered. Below is a revised version Table 2, modified to use scope="col" and scope="row" for the column and row <th> cells, as described in the W3C WAI tutorial “Tables with Two Headers.”