【发布时间】:2021-06-06 14:40:14
【问题描述】:
下面是可重现的代码
# DF
branch <- c("North", "South","South","North","North","South","North")
cars <- c("Toyota","Nissan","BMW","Nissan","Ford","Toyota","Nissan")
insured <- c("Yes","Yes","No","Yes","Yes","Yes","No")
price <- c(21000, 23400, 26800,21000, 23400, 26800,21000)
salesDF <- data.frame(branch, cars,insured, price)
carBranch <- unique(salesDF$branch)
library(shiny)
library(DT)
library(shinydashboard)
library(plotly)
library(tidyverse)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Car Sales"),
# Sidebar with the selectInput Slider
sidebarLayout(
sidebarMenu(
sidebarSearchForm(textId = "Search", buttonId = "search Car",
label = "Search Town")
),
# Show the DataTable
mainPanel(
box(title = "Car Sales", width = 7, height=NULL, solidHeader = T, status = "warning",
plotlyOutput("carBranch"))
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$carBranch <- renderPlotly({
ggplot(salesDF, aes(branch, insured)) +
geom_bar(stat = "identity")
})
}
# Run the application
shinyApp(ui = ui, server = server)
如何根据对特定汽车的搜索来制作情节过滤器?
【问题讨论】:
标签: r shiny shinydashboard shinyapps shiny-reactivity