1

I have a shiny dashboard where I am trying to create multiple sliders that subset the data based on different columns in a data frame.

I have the date slider working, but a slider where I'm trying to filter by a vector of continuous scores between (0,1) doesn't work.... how should I remedy this?

The HireDate filter works alone, when I filter it by "daterange[1]" and daterange[2].... Are the [1], and [2] commands linking the input range to my start and end dates on the ui.R part of the code?

Code below:

server.R

shinyServer(function(input, output) {


  output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x    <- reactive({subset(DATA, HireDate >= input$daterange[1] & 
                           HireDate <= input$daterange[2] & Value >= input$scorecalc[1]   & Value >= input$scorecalc[1] <= input$scorecalc[2]) })
dd <- x()


bins <- seq(0, 1, length.out = input$bins + 1)


hist(dd$ResumeScore, breaks = bins)

# hist(dd$Value, breaks = bins, col = 'darkgray', border = 'white') # 
})
})

ui.R

library(shiny)
shinyUI(pageWithSidebar(
  # Application title
  headerPanel("Dashboard"),
  sidebarPanel( 
    sliderInput("bins",
                "Number of bins:",
                min = 1,
                max = 50,
                value = 30),

    sliderInput("scorecalc",
                "Score:",
                min = 0,
                max = 1,
                            value = 0),


    dateRangeInput("daterange", "Date range:",
                   start  = "2016-08-01",
                   end    = "2016-12-31",
                   min    = "2016-08-01",
                   max    = "2016-12-31",
                   format = "yyyy/mm/dd",
                   separator = "-"),

    submitButton(text="Update!")


    ),
     # OUTPUT PART
    mainPanel(
      tabsetPanel(
      tabPanel("Tab 1", h4("Global Histogram"),plotOutput("distPlot"))

     )
     )
     )) 
HubertL
  • 19,246
  • 3
  • 32
  • 51

0 Answers0