0

I'm using R shiny Dashboard for data visualization in my case i wanted to insert user input into filtering data frame in r

library(shiny)
library(shinydashboard)


ui <- 
  dashboardPage(
    dashboardHeader(title = "Basic dashboard"),
    dashboardSidebar(
      sidebarMenu(

      )

    ),
    dashboardBody(
      # Boxes need to be put in a row (or column)
      fluidRow(
        box(plotOutput("plot1", height = 250)),

        box(
          title = "",
          sliderInput("slider", "Number of Breaks:", 1, 180, 50)
        ),
        box(
          selectInput('BILLING_CENTRE', 'Select Billing Center', names(dfList))
        )
      )
    )
  )

server <- 
  function(input, output) {



    d <- read.csv('Events_for_Jan_suspensions.csv')


    dfList <- split(d, d$BILLING_CENTRE)


    abc <- reactive({input$BILLING_CENTRE})
    if (abc == "AD"){


      histdata <- dfList$AD$SU_TO_OK_DURATION


      output$plot1 <- renderPlot({
        data <- histdata[seq_len(input$slider)]
        hist(data)
      })
    }

  }
shinyApp(ui, server)
Florian
  • 24,425
  • 4
  • 49
  • 80
sabari
  • 3
  • 2
  • Here i have used "if" condition, because without user input i can able to plot the graph. – sabari Jul 19 '17 at 17:34
  • I don't see a question here. What exactly is the behavior you want? It's easier to help you when you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data and clearly describe the desired behavior. – MrFlick Jul 19 '17 at 17:35
  • "dfList" is the grouped datas set whivh have some categorical variable like"AD", so that i could able to plot with this code "histdata <- dfList$AD$SU_TO_OK_DURATION". But in my case the Categorical variable should select by user i need to plot the graph according to that, – sabari Jul 19 '17 at 17:52

0 Answers0