I have a dataset sampled irregularly at 30 min frequency as follows. I need to extract the index of last timestamp on each day. The dataset is as follows:
datetime <-c("8/19/2011 16:00",
"8/19/2011 17:30",
"8/19/2011 18:30",
"8/19/2011 19:30",
"8/22/2011 4:00",
"8/22/2011 6:00",
"8/22/2011 7:00",
"8/22/2011 19:00",
"8/22/2011 19:30",
"8/23/2011 4:00",
"8/24/2011 5:30",
"8/24/2011 7:00",
"10/25/2011 7:30")
I have converted it into POSIXlt object as follows.
datetime <- strptime(datetime, format="%m/%d/%Y %H:%M")
datetime <- as.POSIXlt(datetime)
However, I am not able to extract the last index of each day. I would want an output that as index of last time stamp for each day i.e. my output will be
list of (4, 9, 10,12,13) corresponding to datetime values of
"8/19/2011 19:30"
"8/22/2011 19:30"
"8/23/2011 4:00"
"8/24/2011 7:00"
"10/25/2011 7:30"
Any help will be appreciated. Thanks!