Hi folks,

I must be missing something obvious/painfully simple here....

How do I subset a time vector based on hours AND minutes? So, in this
example, I want all time greater than 10:00, i.e., 10:30 and 11:00.
I'm working with lubridate which separates the hours and minutes into
separate slots.

require(lubridate)

test <- hm(c("9:30", "10:00", "10:30", "11:00"))
test
[1] "9H 30M 0S"  "10H 0M 0S"  "10H 30M 0S" "11H 0M 0S"

This gets 11 but not 1030
test[test@hour > 10]
[1] "11H 0M 0S"

This gets 1030 but not 11
test[test@hour > 9 & test@minute > 0]
[1] "10H 30M 0S"

Thanks and happy new year!
Joe

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to