I've a simple data frame, and I need to filter every column from date: 2020-04-08 and hour 17 onwoards.
I've this:
bcp_desde_las_5 <- bcp %>%
filter(date == "2020-04-08" & hour == 17)
But it only returns data from that date and hour, not onwoards data as desired.
UPDATE:
The filter for hour should only apply to the first date: 2020-04-08. It means that for that day I only need the data from 17 h to midnight. But for every other date, I need every hour of the date.
If the intention is to get the 'hour' greater than or equal to 17, then change the == to >=
library(dplyr)
bcp %>%
filter((date == as.Date("2020-04-08") & hour >= 17)|
(date != as.Date("2020-04-08")))
In order to get every time point from 2020-04-08 and hour 17 onwards, you can use
library(dplyr)
bcp %>%
filter((date == as.Date("2020-04-08") & hour >= 17) | date > as.Date("2020-04-08"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With