Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. aqi = read.csv(file = "C:/Users/stan/Desktop/205410185/1.csv",
  2. header = T, sep = ",")
  3. colnames(aqi) = c("date", "AQI",
  4. "PM10","PM2.5")
  5. ui = fluidPage(
  6. titlePanel('AIR'),
  7. sidebarLayout(
  8. sidebarPanel( selectizeInput("AIR",
  9. "Select Contaminant:",
  10. choices = c("AQI",
  11. "PM2.5",
  12. "10"),
  13. selected = "AQI",
  14. multiple = TRUE )
  15. ),
  16.  
  17. mainPanel(
  18. plotOutput("plot")
  19. )
  20. )
  21. server = function(input, output) {
  22.  
  23. output$plot = renderPlot({
  24. ggplot(aqi) +
  25. geom_line(mapping = aes(x = date, y = aqi[,input$AIR], colour = input$AIR)) +
  26. labs (x = "date", y = "aqi", title = "AIR") +
  27. scale_colour_discrete(name = "AIR")
  28. })
  29. }
  30. shinyApp(ui, server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement