Guest User

Untitled

a guest
Jun 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. library(shinydashboard)
  2. library(shiny)
  3. library(ggplot2)
  4. library(gridExtra)
  5. library(dplyr)
  6. library(tidyverse)
  7. library(lubridate)
  8.  
  9. ui <- dashboardPage(
  10. dashboardHeader(title = "T"),
  11. dashboardSidebar(),
  12. dashboardBody(
  13.  
  14. fluidRow(
  15.  
  16. box(
  17. title = "Controls",
  18. selectInput("User",
  19. "User:",
  20. c("All",
  21. unique(as.character(df$User))))
  22.  
  23. ),
  24. box(
  25. dateRangeInput("dates",
  26. "Date range",
  27. start = "01-01-2018",
  28. end = "06-25-2018")
  29. ),
  30.  
  31. mainPanel(
  32.  
  33. tabsetPanel(type = "tabs",
  34. tabPanel("Plot", plotOutput("plot")
  35.  
  36. )
  37. )
  38. )
  39. )
  40. )
  41. )
  42. server <- function(input, output){
  43. df <- read.csv(file = "c:/T/T/T.csv", header = TRUE, sep = ",")
  44. df$Date <- as.Date(df$Date)
  45.  
  46.  
  47. begin<- reactive({input$dates[1]})
  48. finish<- reactive({input$dates[2]})
  49.  
  50. output$plot <- renderPlot({
  51. df.filtered<-df %>%
  52. filter(df$User == input$User) %>%
  53. filter(Date >= begin(), Date <= finish())
  54. req(df.filtered)
  55. df.filtered
  56. })
  57. }
  58.  
  59. shinyApp(ui, server)
Add Comment
Please, Sign In to add comment