daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Jun 25th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top