-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.R
64 lines (54 loc) · 1.26 KB
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
library(shiny)
library(tidyverse)
library(shinythemes)
options(shiny.autoreload = TRUE)
bcl <- read_csv("bcl-data.csv")
ui <- fluidPage(
theme = shinytheme("cyborg"),
titlePanel("BC Liquor Alcohol Content Explorer"),
fluidRow(
column(
width = 12,
sidebarPanel(
sliderInput("price",
label = "Select a price range",
min= 0,
max = 100,
value = c(20, 35),
pre = "$")
)
),
column(
width = 9,
sidebarPanel(
radioButtons("beverage",
label = "Select beverage type:",
choices = c("BEER", "REFRESHMENT", "SPIRITS", "WINE")
)
)
),
column(
width = 12, mainPanel(
plotOutput("plot")
)
),
tableOutput("table") ,
)
)
server <- function(input, output) {
bcl_filtred <- reactive({
bcl %>%
filter(Price < input$price[2],
Price > input$price[1],
Type == input$beverage)
})
output$plot <- renderPlot({
print(as.list(input))
ggplot(bcl_filtred(), aes(Alcohol_Content)) +
geom_histogram()
})
output$table <- renderTable({
bcl_filtred()
})
}
shinyApp(ui = ui, server = server)