dateRangeInput not functioning in filter

This post was flagged by the community and is temporarily hidden.

Welcome @devv.p888!

Can you say more about what's going wrong? What do you mean by "The filter is not functioning"? What is the expected output of f[f1$Cat %in% input$P & f1$Date %in% input$s2,]? Does f1 have the same number of rows as f? Did you mean to overwrite the original version of f1 to save the filtered version of f? Answers to these questions will help us understand your problem and provide a solution.

Even if you can't provide your real f1 data frame, it would be helpful if you could create a small sample version of f1 that demonstrates the problem your having.

1 Like

Sorry it was a typo error. It is actually f1 <- f[f$Cat %in% input$P & f$Date %in% input$s2,]. I will use this f1 in next plotting function. So f1 is new dataframe I am assigning here based on filters. To be specific if I try only with f1 <- f[f$Cat %in% input$P,] it is working. The moment i include date here, It is not taking

I'm still not sure what you mean by "not working." What, specifically, is going wrong? Please post the output of running the filter operation. Also, please provide the value of input$s2 at the time the filtering operation is run. What do you get if you run f$Date %in% input$s2?

1 Like

I have reedited my code for you. You can actually run it. When you filter on Filter1 and Date, the plot is not getting displayed

error i am getting is
character string is not in a standard unambiguous format

There are two evident problems with this line of code that jump to my eyes.

  • The only value of input$P ("T") is not present on f$Cat so this will always be FALSE
  • %in% operator is for comparing an element against a list of elements, if you try to filter this way you would only match two dates corresponding to the min and max not a range of dates between those two values.
1 Like