I used the following code for subsetting data by date, and that works. But is there an equally simple way to subset data by hours into a new data frame? Sure this requires some parsing with lubridate.
df2 <- df %>%
filter(Time >= as.Date('2020-04-05') & Time <= as.Date('2020-04-06'))
I have used this practice data
df <- structure(list(Date = c("2.5.2012", "2.5.2012", "2.5.2012", "2.5.2012",
"3.5.2012", "3.5.2012", "3.5.2012", "3.5.2012", "3.5.2012", "4.5.2012",
"4.5.2012", "5.5.2012", "5.5.2012", "5.5.2012", "5.5.2012", "5.5.2012",
"6.5.2012", "6.5.2012", "7.5.2012", "7.5.2012", "8.5.2012", "8.5.2012",
"8.5.2012", "8.5.2012", "8.5.2012", "9.5.2012", "9.5.2012", "9.5.2012",
"9.5.2012", "9.5.2012", "9.5.2012", "9.5.2012", "9.5.2012", "9.5.2012",
"9.5.2012", "9.5.2012", "9.5.2012", "9.5.2012", "10.5.2012",
"10.5.2012", "10.5.2012", "10.5.2012", "10.5.2012", "10.5.2012",
"11.5.2012", "11.5.2012", "11.5.2012", "12.5.2012", "12.5.2012",
"14.5.2012", "14.5.2012", "14.5.2012", "15.5.2012", "15.5.2012",
"15.5.2012", "15.5.2012", "15.5.2012", "16.5.2012", "16.5.2012",
"17.5.2012", "17.5.2012", "17.5.2012", "17.5.2012", "17.5.2012",
"18.5.2012", "18.5.2012", "18.5.2012", "18.5.2012", "18.5.2012",
"19.5.2012", "20.5.2012", "20.5.2012", "20.5.2012", "20.5.2012",
"21.5.2012", "21.5.2012", "21.5.2012", "21.5.2012", "21.5.2012",
"21.5.2012", "21.5.2012", "21.5.2012", "22.5.2012", "22.5.2012",
"22.5.2012", "22.5.2012", "22.5.2012", "22.5.2012", "22.5.2012",
"22.5.2012", "22.5.2012", "23.5.2012", "23.5.2012", "23.5.2012",
"23.5.2012", "23.5.2012", "23.5.2012", "23.5.2012", "23.5.2012",
"23.5.2012"), Time = c("07:30", "17:20", "18:40", "19:40", "09:30",
"09:40", "18:00", "16:30", "18:30", "13:50", "09:00", "12:20",
"09:20", "09:00", "12:20", "20:10", "11:20", "08:10", "12:20",
"13:30", "10:00", "20:40", "10:40", "12:50", "20:30", "09:30",
"13:40", "10:30", "10:20", "13:00", "13:30", "10:40", "14:10",
"12:40", "14:40", "16:20", "16:10", "22:40", "08:40", "13:40",
"12:30", "14:20", "16:30", "15:00", "10:50", "09:40", "20:00",
"12:30", "09:20", "13:10", "13:10", "08:00", "14:00", "19:30",
"17:50", "16:30", "19:40", "12:40", "20:00", "07:20", "10:20",
"07:30", "15:30", "20:00", "08:00", "08:50", "10:40", "12:00",
"12:20", "16:30", "09:00", "20:50", "17:40", "18:50", "08:30",
"13:00", "10:00", "16:20", "18:40", "19:20", "19:20", "19:40",
"19:10", "11:30", "09:10", "10:10", "13:20", "15:20", "16:30",
"19:30", "20:00", "09:00", "11:50", "09:00", "12:00", "13:00",
"09:00", "14:10", "10:30", "13:20")), row.names = c(NA, -100L
), class = c("tbl_df", "tbl", "data.frame"))