data_extract_ui: 'teal' data extraction module user-interface

View source: R/data_extract_module.R

data_extract_uiR Documentation

teal data extraction module user-interface

Description

[Experimental]

Usage

data_extract_ui(id, label, data_extract_spec, is_single_dataset = FALSE)

Arguments

id

(character) shiny input unique identifier.

label

(character) Label above the data extract input.

data_extract_spec

(list of data_extract_spec) This is the outcome of listing data_extract_spec() constructor calls.

is_single_dataset

(logical) FALSE to display the dataset widget.

Details

There are three inputs that will be rendered

  1. 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.

  2. 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.

  3. 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(...).

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().

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.

Examples

library(shiny)
library(teal.widgets)

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
standard_layout(
  output = tableOutput("table"),
  encoding = div(
    data_extract_ui(
      id = "regressor",
      label = "Regressor Variable",
      data_extract_spec = response_spec
    )
  )
)


teal.transform documentation built on May 29, 2024, 5:06 a.m.