这是我使用php的代码
library(shiny)
library(dplyr)
Product_List = data.frame(Status=c(1,2,3,4,5))
ui <- fluidPage(
titlePanel("Products"),
sidebarLayout(
sidebarPanel(
uiOutput("statusOutput"),
sliderInput("modelInput","Model Number", 0,200,c(100,200))
),
mainPanel(
tableOutput("results")
)
)
)
server <- function(input, output) {
output$statusOutput <- renderUI({
selectizeInput("statusInput","Status",
sort(unique(Product_List$Status)),multiple=TRUE,options=list(placeholder="All"))
})
filtered <- reactive ({
if (length(input$statusInput)==0) {
return(Product_List)
}
Product_List %>%
filter(Status %in% input$statusInput )
})
output$results<-renderTable({
filtered()
})
}
shinyApp(ui = ui, server = server)
$ result是用于diplaying和后缀的Variabel