Shiny TidyModule to select variables from a data set. Includes exporting functionality (to HTML). Interface uses bs4Dash.

Format

R6 class

Input

dataset

A data sets. Can be tibble, data frame, etc.

options

The options for the module of type reactiveValues with values

datasetname

The default dataset name that will appear in the header. Default: ""

idvar

ID field that is common across all datasets in input:datalist. Default USUBJID

Output

filtered_indices

The output data set indices after filtering, selecting and reordering columns.

filtered_data

The output data set after filtering, selecting and reordering columns.

filtered_columns

The names of the columns that have been selected.

search_columns

The searches applied to the data table.

See also

Super class

tidymodules::TidyModule -> VariableSelection

Methods

Public methods

Inherited methods

Method new()

Usage

VariableSelection$new(...)


Method ui()

Usage

VariableSelection$ui()


Method server()

Usage

VariableSelection$server(
  input,
  output,
  session,
  dataset = NULL,
  options = NULL
)


Method clone()

The objects of this class are cloneable with this method.

Usage

VariableSelection$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { library(tidymodules) library(bs4Dash) library(subpat) varSelMod <- VariableSelection$new() ui <- tagList( shinyjs::useShinyjs(), bs4DashPage( sidebar = bs4DashSidebar(disable = TRUE), body = bs4DashBody( fileInput("file1", "Choose SAS File", multiple = FALSE, accept = c(".sas7bdat")), conditionalPanel(condition = 'output.file_uploaded', varSelMod$ui(), verbatimTextOutput('tableIndices'), verbatimTextOutput('filteredTable'), verbatimTextOutput('searchColumns')) ) ) ) # Define server logic server <- function(input, output) { opts <- reactiveValues( datasetname = NULL, idvar = "USUBJID" ) varSelMod$callModule() output$file_uploaded <- reactive({ return(!is.null(input$file1)) }) outputOptions(output, 'file_uploaded', suspendWhenHidden=FALSE) observe({ req(input$file1) dat <- haven::read_sas(input$file1$datapath) opts$datasetname <- input$file1$name # Pass the uploaded data into the module reactive(dat) %>1% varSelMod # Pass the options into the module opts %>2% varSelMod }) # Show the output indices from the module output$tableIndices <- renderPrint({ print(varSelMod$getOutput("filtered_indices")()) }) # Show the filtered data from the table output$filteredTable <- renderPrint({ print(varSelMod$getOutput("filtered_data")()) }) # Show the strings entered in the search columns output$searchColumns <- renderPrint({ print(varSelMod$getOutput("search_columns")()) }) } # Run the application shinyApp(ui = ui, server = server) }