View source: R/tm_data_table.R
tm_data_table | R Documentation |
teal
module: Data table viewerModule 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.
tm_data_table(
label = "Data Table",
variables_selected = list(),
datasets_selected = deprecated(),
datanames = if (missing(datasets_selected)) "all" else datasets_selected,
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,
transformators = list()
)
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.
Object of class teal_module
to be used in teal
applications.
# general data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
iris <- 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 = "IRIS Table Caption")
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- teal.data::rADSL
})
join_keys(data) <- default_cdisc_join_keys[names(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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.