teal data extraction module user-interface
data_extract_ui.Rd
This functionality should be used in the encoding panel of your teal
app. It will
allow app-developers to specify a data_extract_spec object. This object should be used
to teal module variables being filtered data from CDISC
datasets. You can use this function in the same way as any
shiny module UI. The corresponding server module
can be found in data_extract_srv()
.
Arguments
- id
(
character
) shiny input unique identifier- label
(
character
) Label above the data extract input- data_extract_spec
(
list
ofdata_extract_spec
) This is the outcome of listing data_extract_spec constructor calls.- is_single_dataset
(
logical
) FALSE to display the dataset widget
Value
shiny shiny::selectInputs
that allow to define how to extract data from
a specific dataset. The input elements will be returned inside a shiny::div container.
There are three inputs that will be rendered
Dataset select Optional. If more than one data_extract_spec is handed over to the function, a shiny shiny::selectInput will be rendered. Else just the name of the dataset is given.
Filter Panel Optional. If the data_extract_spec contains a filter element a shiny shiny::selectInput will be rendered with the options to filter the dataset.
Select panel A shiny shiny::selectInput to select columns from the dataset to go into the analysis.
The output can be analyzed using data_extract_srv(...)
.
Examples
library(shiny)
adtte_filters <- filter_spec(
vars = c("PARAMCD", "CNSR"),
sep = "-",
choices = c("OS-1" = "OS-1", "OS-0" = "OS-0", "PFS-1" = "PFS-1"),
selected = "OS-1",
multiple = FALSE,
label = "Choose endpoint and Censor"
)
response_spec <- data_extract_spec(
dataname = "ADTTE",
filter = adtte_filters,
select = select_spec(
choices = c("AVAL", "BMRKR1", "AGE"),
selected = c("AVAL", "BMRKR1"),
multiple = TRUE,
fixed = FALSE,
label = "Column"
)
)
# Call to use inside your teal module UI function
teal.widgets::standard_layout(
output = tableOutput("table"),
encoding = div(
data_extract_ui(
id = "regressor",
label = "Regressor Variable",
data_extract_spec = response_spec
)
)
)
#> <div class="row">
#> <div class="col-md-3">
#> <div class="well">
#> <div>
#> <style type="text/css">/* teal.transform data_extract css */
#>
#> .data-extract {
#> border-left: 3px solid #e3e3e3;
#> padding-left: 0.6em;
#> border-radius: 5px;
#> margin-left: -0.6em;
#> margin-bottom: 1em;
#> }
#>
#> .data-extract label.control-label {
#> font-weight: normal;
#> color: grey;
#> }
#>
#> .data-extract .filter_spec > div:first-child {
#> margin-bottom: 5px;
#> }</style>
#> <div class="data-extract">
#> <label>Regressor Variable</label>
#> <span class="help-block">
#> Dataset:
#> <code>ADTTE</code>
#> </span>
#> <div>
#> <div>
#> <div class="filter_spec">
#> <div class="shinyjs-hide">
#> <div class="form-group shiny-input-container shinyjs-hide">
#> <label class="control-label shiny-label-null" for="regressor-dataset_ADTTE_singleextract-filter1-col"></label>
#> <select data-actions-box="true" data-none-selected-text="- Nothing selected -" data-max-options="Inf" data-show-subtext="true" data-live-search="false" id="regressor-dataset_ADTTE_singleextract-filter1-col" class="selectpicker form-control" multiple="multiple"><option value="PARAMCD" selected>PARAMCD</option>
#> <option value="CNSR" selected>CNSR</option></select>
#> </div>
#> <label id="regressor-dataset_ADTTE_singleextract-filter1-col_textonly" class="control-label"></label>
#> <code id="regressor-dataset_ADTTE_singleextract-filter1-col_valueonly">PARAMCD, CNSR</code>
#> </div>
#> <div class="form-group shiny-input-container">
#> <label class="control-label" for="regressor-dataset_ADTTE_singleextract-filter1-vals">Choose endpoint and Censor</label>
#> <select data-actions-box="false" data-none-selected-text="- Nothing selected -" data-max-options="1" data-show-subtext="true" data-live-search="false" id="regressor-dataset_ADTTE_singleextract-filter1-vals" class="selectpicker form-control" multiple="multiple"><option value="OS-1" selected>OS-1</option>
#> <option value="OS-0">OS-0</option>
#> <option value="PFS-1">PFS-1</option></select>
#> </div>
#> </div>
#> </div>
#> <div class="form-group shiny-input-container">
#> <label class="control-label" for="regressor-dataset_ADTTE_singleextract-select">Column</label>
#> <select data-actions-box="true" data-none-selected-text="- Nothing selected -" data-max-options="Inf" data-show-subtext="true" data-live-search="false" id="regressor-dataset_ADTTE_singleextract-select" class="selectpicker form-control" multiple="multiple"><option value="AVAL" selected>AVAL</option>
#> <option value="BMRKR1" selected>BMRKR1</option>
#> <option value="AGE">AGE</option></select>
#> </div>
#> <div class="form-group shiny-input-container shinyjs-disabled shinyjs-hide">
#> <div class="checkbox">
#> <label>
#> <input id="regressor-dataset_ADTTE_singleextract-reshape" type="checkbox"/>
#> <span>Reshape long to wide format</span>
#> </label>
#> </div>
#> </div>
#> </div>
#> </div>
#> </div>
#> </div>
#> </div>
#> <div class="col-md-9">
#> <div class="well">
#> <div class="pre-output"></div>
#> <div class="output">
#> <div id="table" class="shiny-html-output"></div>
#> </div>
#> <div class="post-output"></div>
#> </div>
#> </div>
#> </div>