0

I have a shiny application, where I want to plot data based on periodic selection. Primarily I was selecting data based on one input id, that was year. And the application was working perfectly.
Now I have created functionality of from & to, & I would like to cut data based on these selection.

Now I am having two input ids. My intention is that in from I select 2014 & in to if I select 2017, the plot should select the data 2014:2017, & it should dynamically change in accordance with selection for both the entries. But, subset function is not working with two inputIDs.

Primarily, my wellPanel was:

selectInput(inputId = "n_rows",label = "Select period to plot",choices = c(),selected = c(),multiple = T)

& in server, the line subsetting the data based on selection, was:

plotdata <- subset(rawdata, date %in% input$n_rows)

It was working perfectly.

Now, I have written the from , to functionality

selectInput(inputId = "from_rows",label = "Start period to plot",choices = c(),selected = c(),multiple = F),

and

selectInput(inputId = "to_rows",label = "End period to plot",choices = c(),selected = c(),multiple = F)

In server, I have written:

plotdata <- subset(rawdata, date %in% c(input$from_rows:input$to_rows))

This is not working. Please refer to the attached image so view the screen of my present app.
I will click the Plot_Pred button to plot, which currently is not working.

The plot should come by considering data from start selection to the end selection. Please guide me on how I can make the subset function work.

Please find attached the old app screenshot too. TIA!

Capt.Krusty
  • 597
  • 1
  • 7
  • 26
Hindol Ganguly
  • 363
  • 1
  • 4
  • 16

0 Answers0