tm_data_table {teal.modules.general} | R Documentation |
teal
module: Data table viewer
Description
Module provides a dynamic and interactive way to view data.frame
s in a teal
application.
It uses the DT
package to display data tables in a paginated, searchable, and sortable format,
which helps to enhance data exploration and analysis.
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 |
( |
variables_selected |
( |
datasets_selected |
( |
dt_args |
( |
dt_options |
( |
server_rendering |
( |
pre_output |
( |
post_output |
( |
Details
The DT
package has an option DT.TOJSON_ARGS
to show Inf
and NA
in data tables.
Configure the DT.TOJSON_ARGS
option via
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.
Value
Object of class teal_module
to be used in teal
applications.
Examples
# general data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
iris <- iris
})
datanames(data) <- c("iris")
app <- init(
data = data,
modules = modules(
tm_data_table(
variables_selected = list(
iris = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species")
),
dt_args = list(caption = "ADSL Table Caption")
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- rADSL
})
datanames(data) <- "ADSL"
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
app <- init(
data = data,
modules = modules(
tm_data_table(
variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX")),
dt_args = list(caption = "ADSL Table Caption")
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}