I have a data frame like below:
entry_no id time _________ ___ _____ 1 1 2016-09-01 09:30:09 2
You could achieve it with a bit of simple formatting:
dat$hms <- format(as.POSIXct(dat$time), "%H:%M:%S") dat[dat$hms >= "09:00:00" & dat$hms <= "10:00:00",] # entry_no id time hms #1 1 1 2016-09-01 09:30:09 09:30:09