Skip to contents

A data table viewer shows the data using a paginated table.

Usage

tm_data_table(
  label = "Data Table",
  variables_selected = list(),
  datasets_selected = character(0),
  dt_args = list(),
  dt_options = list(searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100),
    scrollX = TRUE),
  server_rendering = FALSE,
  pre_output = NULL,
  post_output = NULL
)

Arguments

label

(character(1)) Label shown in the navigation item for the module.

variables_selected

(list) A named list of character vectors of the variables (i.e. columns) which should be initially shown for each dataset. Names of list elements should correspond to the names of the datasets available in the app. If no entry is specified for a dataset, the first six variables from that dataset will initially be shown.

datasets_selected

(character) A vector of datasets which should be shown and in what order. Names in the vector have to correspond with datasets names. If vector of length zero (default) then all datasets are shown.

dt_args

(named list) Additional arguments to be passed to DT::datatable (must not include data or options).

dt_options

(named list) The options argument to DT::datatable. By default list(searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100), scrollX = TRUE)

server_rendering

(logical) should the data table be rendered server side (see server argument of DT::renderDataTable())

pre_output

(shiny.tag, optional)
with text placed before the output to put the output into context. For example a title.

post_output

(shiny.tag, optional) with text placed after the output to put the output into context. For example the shiny::helpText() elements are useful.

Details

The DT package has an option DT.TOJSON_ARGS to show Inf and NA in data tables. If this is something you require then set options(DT.TOJSON_ARGS = list(na = "string")) before running the module. Note though that sorting of numeric columns with NA/Inf will be lexicographic not numerical.

Examples

library(scda)

ADSL <- synthetic_cdisc_data("latest")$adsl

app <- init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
    check = TRUE
  ),
  modules = modules(
    tm_data_table(
      variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX")),
      dt_args = list(caption = "ADSL Table Caption")
    )
  )
)
#> [INFO] 2022-10-14 01:38:19.5894 pid:2564 token:[] teal.modules.general Initializing tm_data_table
if (FALSE) {
shinyApp(app$ui, app$server)
}