-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_1.R
More file actions
42 lines (33 loc) · 1.05 KB
/
Copy pathapp_1.R
File metadata and controls
42 lines (33 loc) · 1.05 KB
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
# TODO
# ADD AN ALL OPTION AND CHANGE THE LINETYPE BY CATEGORY
# CHANGE THE CHOICES INPUT BASED ON THE DATA AND NOT A STATIC DATA
library(shiny)
library(tidyverse)
ui <- fluidPage(
h1("Trial One"),
p("Some Description about our application")
selectInput("category", "Select Category",
choices = c("Ozone", "Solor.R", "Wind", "Temp")),
renderUI("text1")
plotOutput("testing")
)
server <- function(input, output, session) {
long <- as.data.frame.matrix(airquality) %>%
pivot_longer(cols = c("Ozone", "Solar.R", "Wind", "Temp"),
names_to = "category", values_to = "value") %>%
mutate(value = as.character(value))
reactive <- reactive({
long <- long %>%
filter(category == input$category)
})
output$text1 <- renderUI({
h1(paste("Category Selected -", input$category))
})
output$testing <- renderPlot({
ggplot(reactive) +
geom_line(aes(x = paste(Month, Day), y = value,
color = category)) +
ggtitle("Ozone Data Time")
})
}
shinyApp(ui, server)