I have a data set where I'd like to delete the rows after a certain column value comes up
An example of the data set:
a<-data.frame(Account=c('A','A','A','A','A','A','A','A','A'),
ProcessDate=seq(as.Date('2020-01-01'),as.Date('2020-09-01'),by='month'),
Payment=c(1,2,3,4,5,6,7,8,9),
ColumnCriteria=c(610,610,610,610,610,650,610,610,610))
I would like to delete the rows after the ColumnCriteria = 650.
My problem is that I'm working with a large data set so I cannot just use the filter function with a few lags because where the 650 is in this example, will be different for another Account.
I'm thinking I could potentially write an if_else statement where if the ColumnCriteria is equal to 650 then return the Date and then I could try to fill the column with that date and then filter the rows where the ProcessDate is greater. This seems a little messy so I figured I'd reach out and see if anyone had any suggestions.
Thanks!