Regular Expressions in 'shiny' Select Lists

'shiny' extension that adds regular expression filtering capabilities to the choice vector of the select list.


R package to enable regular expression searches within a shiny selectize object.

install

devtools::install_github('yonicd/regexSelect')

Examples

renderTable

 
require(shiny)
 
if(interactive()){
ui <- shiny::fluidPage(
regexSelectUI(id = "a", label = "Variable:",choices = names(iris)),
shiny::tableOutput("data")
)
 
server <- function(input, output, session) {
  curr_cols<-callModule(regexSelect, "a",shiny::reactive(names(iris)))
  
  observeEvent(curr_cols(),{
  cols_now<-curr_cols()
  if(length(cols_now)==0)  cols_now<-names(iris)
  output$data <- shiny::renderTable({iris[,cols_now , drop = FALSE]}, rownames = TRUE)
  })
}
 
shiny::shinyApp(ui, server)
 
}

renderPlot

 
library(ggplot2)
ui <- fluidPage(
  selectInput('var','Choose Variable',
              choices = names(diamonds)[sapply(diamonds,function(x) inherits(x,c('character','factor')))],
              selected = 'clarity'),
  uiOutput('regexchoose'),
  plotOutput("data")
  )
  
server <- function(input, output, session) {
  
  output$regexchoose<-shiny::renderUI({
    regexSelectUI(id = "a", label = input$var,choices = unique(diamonds[[input$var]]))
  })
  
  observeEvent(input$var,{
    curr_cols<-callModule(regexSelect, "a",shiny::reactive(unique(diamonds[[input$var]])))
    
    observeEvent(curr_cols(),{
      cols_now<-curr_cols()
      output$data <- shiny::renderPlot({
        ggplot(diamonds[diamonds[[input$var]]%in%cols_now,],aes_string(x='table',y='carat',colour=input$var))+geom_point()
      })
    })    
  })
  
}
  
shinyApp(ui, server)

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("regexSelect")

1.0.0 by Jonathan Sidi, 2 years ago


https://github.com/yonicd/regexSelect


Report a bug at https://github.com/yonicd/regexSelect/issues


Browse source code at https://github.com/cran/regexSelect


Authors: Jonathan Sidi [aut, cre]


Documentation:   PDF Manual  


GPL-2 | GPL-3 license


Imports shiny, shinyjs


See at CRAN