Customizing Display Tables: Using CSS with DT and kableExtra

Will Beasley
SCUG 2018-10-02

DataTables (DT)

DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, build upon the foundations of progressive enhancement, that adds all of these advanced features to any HTML table.

kableExtra

When we are talking about table generators in R, knitr's kable() function is usually a popular choice because of its ultimate simplicity. Unlike those powerful table rendering engines such as xtable, the philosophy behind knitr::kable() is to make it easy for programmers to use.

CSS

  • declare styles separately from content.
  • selectors: type vs class vs id
  • lots of browser-based sandboxes (example)
  • archer.html

Debugging Browser

ctrl-shift-j

Alternatives to CSS file

  • embedded in Rmd
  • custom function

More DT

Other R Packages for Creating Tables