patternSelectionInput: Select variables based on pattern (or a regular expression)

Description Usage Arguments Value Examples

View source: R/patternSelection_module.R

Description

Select variables based on pattern (or a regular expression)

patternSelection module server function

Usage

1
2
3
patternSelectionInput(id)

patternSelection(input, output, session, choices = reactiveValues())

Arguments

id

shiny id

input

shiny input

output

shiny output

session

shiny session

choices

reactivevalues object containing vectors of possible choices for each selection variable

Value

a reactivevalues object with:

values

: selected values

variable

: selected variable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 
library(shiny)

 if (interactive()){
  
  ui <- fluidPage(
    selectizeInput("selection",
                   label = "selected values",
                   choices = NULL, selected = NULL, multiple = TRUE),
    patternSelectionInput("pattern_module")
  )
  
  server <- function(input, output, session) {
    
    choices <- reactiveValues()
    
    observe({
      gs <- load_gs("./inst/ext/gs")
      choices$sample <- pData(gs)$name
      choices$subset <- gs_get_pop_paths(gs)
    })
    
    res <- callModule(patternSelection, "pattern_module", choices = choices)
    
    observe({
      if(!is.null(res$variable)){
        updateSelectizeInput(session, "selection", 
          choices = choices[[res$variable]], selected = res$values)
      }
    })
    
  }
  
  shinyApp(ui, server)
  
}
## End(Not run)

VoisinneG/flowR documentation built on June 1, 2021, 6:42 p.m.