I have a long dataframe df1
for which I want to select only those rows that satisfy next: df1$Delay
rows are CONSECUTIVE and they completely match values of vector A
IN THE SAME ORDER. As an example:
df1 <- data.frame(DateTime=c("2016-08-28 12:02:34.589","2016-08-28 12:03:23.589","2016-08-28 12:04:28.589","2016-08-28 12:07:56.589","2016-08-28 12:10:14.589","2016-08-28 12:12:34.589","2016-08-28 12:13:44.589","2016-08-28 12:15:43.589","2016-08-28 12:19:28.589","2016-08-28 12:22:34.589"),
Depth=c(12,34,56,12,3,45,52,23,32,18),
Delay=c(56,34,90,36,78,90,34,56,101,56))
df1
DateTime Depth Delay
1 2016-08-28 12:02:34.589 12 56
2 2016-08-28 12:03:23.589 34 34
3 2016-08-28 12:04:28.589 56 90
4 2016-08-28 12:07:56.589 12 36
5 2016-08-28 12:10:14.589 3 78
6 2016-08-28 12:12:34.589 45 90
7 2016-08-28 12:13:44.589 52 34
8 2016-08-28 12:15:43.589 23 56
9 2016-08-28 12:19:28.589 32 101
10 2016-08-28 12:22:34.589 18 56
A <- c(90,34,56)
In this case, I would expect to get his:
Result
DateTime Depth Delay
1 2016-08-28 12:12:34.589 45 90
2 2016-08-28 12:13:44.589 52 34
3 2016-08-28 12:15:43.589 23 56