My question is basically a follow-up on the question previously raised here by user Wet Feet:
This is the modified dataset:
date_time loc_id node energy kgco2
1 2009-02-27 00:11:08 87 103 0.00000 0.00000
2 2009-02-27 01:05:05 87 103 7.00000 3.75900
3 2009-02-27 02:05:05 87 103 6.40039 3.43701
4 2009-02-28 02:10:05 87 103 4.79883 2.57697
5 2009-02-28 04:05:05 87 103 4.10156 2.20254
6 2009-02-28 05:05:05 87 103 2.59961 1.39599
7 2009-03-01 03:20:05 87 103 2.59961 1.39599
I am trying to get only those rows which fall within a specific time interval, e.g. 02:05:00 to 03:30:00.
3 2009-02-27 02:05:05 87 103 6.40039 3.43701
4 2009-02-28 02:10:05 87 103 4.79883 2.57697
7 2009-03-01 03:20:05 87 103 2.59961 1.39599
Applying the solution in the linked question (hour
from the lubridate
package), however, doesn't suffice since I also have to consider the minutes of my interval. I could use the interval
function from the lubridate
package to include minutes, but since my dataframe covers different dates, it wouldn't help.
I am particularly curious whether there is any solution allowing to make use of dplyr
's filter
verb. Or is using the xts
package the only way forward?