Can I have a multiple filter. I have created a new column in Iris data set called "New". I also want "New" column filter along with "Species" filter. Below is the code for reference
sample1 <- 1:3
library(shiny)
iris$New <- ifelse(iris$Sepal.Width>2.5,"greater than 2.5","Not Greater
than 2.5")
ui <- fluidPage(
sidebarLayout(
sidebarPanel(selectInput("x","Operations",choices =
c("summary","stem","typeof","mode","birth"),
multiple=FALSE,selectize = TRUE)),
mainPanel(h6("Here it is"),
verbatimTextOutput("message"),
uiOutput("Species")
)
)
)
server <- function(input, output, session) {
r1 <- reactive({
if(input$x == "summary")
{
summary(iris$Petal.Width[iris$Species == input$Species])
} else if (input$x == "stem")
{
print(stem(faithful$eruptions))
} else if (input$x == "typeof")
{
typeof(sample1)
} else if (input$x == "mode")
{
mode(sample1)
}
})
output$message <- renderPrint({r1()})
output$Species <- renderUI({
selectInput("Species", "species",
choices = as.character(unique(iris$Species)), multiple = FALSE)
})
}
shinyApp(ui, server)