regexSelect {regexSelect}R Documentation

Create a selectize list input control with regular expression capabilities

Description

Create a selectize list that can be used to choose a single or multiple items from a list of values with extension for regular expression.

Usage

regexSelect(input, output, session, data)

Arguments

input

The input slot that will be used to access the value.

output

The output variable to read the list of values returned be regex query

session

The session of the shiny application

data

reactive element contains a character vector where matches are sought, or an object which can be coerced by as.character to a character vector

Value

reactive character vector

Examples

if(interactive()){
ui <- shiny::fluidPage(
regexSelectUI(id = "a", label = "Variable:",choices = names(iris)),
shiny::tableOutput("data")
)


ui.show <- shiny::fluidPage(
regexSelectUI(id = "a", label = "Variable:",choices = names(iris),checkbox.show = TRUE),
shiny::tableOutput("data")
)

server <- function(input, output, session) {
 curr_cols<-shiny::callModule(regexSelect, "a",shiny::reactive(names(iris)))
 
 shiny::observeEvent(curr_cols(),{
 cols_now<-curr_cols()
 if(length(cols_now)==0)  cols_now<-names(data())
 output$data <- shiny::renderTable({iris[,cols_now , drop = FALSE]}, rownames = TRUE)
 })
}

#do not show regex checkboxes
shiny::shinyApp(ui, server)

#show regex checkboxes
shiny::shinyApp(ui.show, server)
 }

[Package regexSelect version 1.0.0 Index]