I have a dataframe with many rows that are all repeated values except for the values in column dd.
If any one row contains the value "ACT" in this non-repeated column I need to remove all the rows which otherwise match this "ACT" row as well as the "ACT" row itself. So in the sample code I would want to retain only the six rows which contain "c" and "e" in column aa.
I have tried a variety of nested if-else with for loops and trying to somehow filter out based on value in aa when the "ACT" exist in dd but have not been able to figure out how to get away from the single row vector matching.
aa <- c("b","b","b","c","c","c","d","d","d","e","e","e")
bb <- c("t","t","t","w","w","w","r","r","r","s","s","s")
cc <- c(1,1,1,2,2,2,3,3,3,4,4,4)
dd <- c("CVR","ACT","CVR","CVR","CVR","CVR","ACT","CVR","CVR","CVR","CVR","CVR")
Ideally I'm look for a tidyverse solution but am open to anything of course.