How can I keep only rows containing full hours (time)?

Viewed 24

I have a dataframe with time in 10 min intervals.

   date        time     h150 h200 h250 h500 h750 h1000 h1250 h1500
1   2018-06-01 07:40:00  7.2  8.0  7.8  7.9  7.8   7.8   7.9   7.9
2   2018-06-01 07:50:00  7.3  8.3  8.1  8.3  8.1   8.2   8.3   8.1
3   2018-06-01 08:00:00  7.5  9.0  8.3  8.4  8.2   8.2   8.5   8.3
4   2018-06-01 08:10:00  7.4  7.5  6.7  6.3  6.1   6.0   6.0   7.2
5   2018-06-01 08:20:00  7.4  5.9  5.7  5.6  5.4   5.4   5.3   5.3
6   2018-06-01 08:30:00  7.5  5.7  5.7  5.6  5.5   5.4   5.3   5.3
7   2018-06-01 08:40:00  7.5  5.7  5.7  5.6  5.5   5.4   5.3   5.3
8   2018-06-01 08:50:00  7.5  5.6  5.7  5.6  5.6   5.5   5.3   5.3
9   2018-06-01 09:00:00  7.4  5.6  5.7  5.6  5.6   5.5   5.3   5.3
10  2018-06-01 09:10:00  7.4  5.6  5.6  5.6  5.6   5.4   5.3   5.3
11  2018-06-01 09:20:00  7.4  5.6  5.6  5.6  5.5   5.5   5.4   5.3
12  2018-06-01 09:30:00  7.4  5.6  5.6  5.6  5.5   5.5   5.4   5.3

I only want to keep rows with full hours (i.e. 15:00:00). How can I do this?

Thanks!

1 Answers

Perhaps this helps

library(dplyr)
library(stringr)
df1 %>% 
  filter(str_detect(time, ":00:00$"))
Related