Getting Started with ROvis.table

ROvis.table provides two ways to build accessible, Rijksoverheid-styled tables: ro_gt_theme() for static gt tables, and ro_dt_table() (with ro_dt_theme()) for interactive, keyboard-navigable DT tables.

library(ROvis.table)

Static tables with gt

Apply ro_gt_theme() to a gt table built from any data frame:

ro_gt_theme(head(mtcars, 5))
mpg cyl disp hp drat wt qsec vs am gear carb
21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
18.7 8 360 175 3.15 3.440 17.02 0 0 3 2

Interactive tables with DT

ro_dt_table() wraps DT::datatable() with accessible defaults (ARIA-labelled pagination, sensible page length). Pair it with ro_dt_theme() in a Shiny UI for consistent styling:

ro_dt_table(
  data = head(mtcars, 20),
  caption = "Motor Trend car road tests",
  sorting = TRUE,
  pagelength = 10
)

In a Shiny app, add ro_dt_theme() alongside your DTOutput():

library(shiny)

ui <- fluidPage(
  ro_dt_theme(sorting = TRUE),
  DT::DTOutput("mytable")
)

server <- function(input, output, session) {
  output$mytable <- DT::renderDT(
    ro_dt_table(mtcars, caption = "Motor Trend car road tests", sorting = TRUE)
  )
}

shinyApp(ui, server)