I would like to remove all rows that are followed by the same entry in R. I have the following column in a data frame:
"FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "FAILURE" "HIT" "FAILURE" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "FAILURE" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "FAILURE" "FAILURE" "HIT"
I would like to delete all rows in which the "FAILURE" entry is followed by another "FAILURE" entry. So I would like to get the following colomn of the data frame back:
"FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT" "FAILURE" "HIT"
How can I check if the next row meets that condition and remove those rows?