I'm having the following problem:
I have a large dataframe for which I'd like to delete every row that matches this condition: if a value (string) inside a column contains the ":" char and the next row also contains a ":" char, it would delete the first one.
Something like this:
a <- c("value1","value2","value2:a","value2:b","value3")
b <- c(1,2,3,4,5)
df1 <- data.frame(b,a)
b a
1 1 value1
2 2 value2
3 3 value2:a
4 4 value2:b
5 5 value3
to this, where only the row containing the name "value2:a" gets deleted because is followed by a row that contains the regex ":"
a b
value1 1
value2 2
value2:b 4
value3 5
Thank you very much in advance, I've been trying out some solutions with for loops and the grepl function but can't seem to make it work.