I don't know that tidyverse
contains just the right function for this, but base R can handle it (and therefore it can be included in a pipe).
Some sample data:
dat <- data.frame(Cycle = c(1:5,20,"***",21,22),
Time = Sys.time() + 1:9,
stringsAsFactors = FALSE)
dat
# Cycle Time
# 1 1 2017-06-26 14:02:48
# 2 2 2017-06-26 14:02:49
# 3 3 2017-06-26 14:02:50
# 4 4 2017-06-26 14:02:51
# 5 5 2017-06-26 14:02:52
# 6 20 2017-06-26 14:02:53
# 7 *** 2017-06-26 14:02:54
# 8 21 2017-06-26 14:02:55
# 9 22 2017-06-26 14:02:56
dat[! cumany(grepl("\\*\\*\\*", dat$Cycle)),]
# Cycle Time
# 1 1 2017-06-26 14:02:48
# 2 2 2017-06-26 14:02:49
# 3 3 2017-06-26 14:02:50
# 4 4 2017-06-26 14:02:51
# 5 5 2017-06-26 14:02:52
# 6 20 2017-06-26 14:02:53
You can make it look more readable with
dat[! cumany(grepl("***", dat$Cycle, fixed = TRUE)),]
So it can be inserted readily in a %>%
pipeline:
library(dplyr)
dat %>%
filter(! cumany(grepl("***", Cycle, fixed = TRUE)))
With your shown data, this should suffice. If there is any ambiguity of values within $Cycle
, you should probably use a more resilient pattern for matching the cutoff.