Suppose I have the following column
**CurrentStatus**
Current
NoChange
NoChange
NoChange
NoChange
Late
I want to mutate it so that if the v
You could use something like this:
rfwd<-function(value,trigger)
{
c("",value)[cummax(seq_along(value)*(trigger))+1]
}
and your answer would be rfwd(CurrentStatus,CurrentStatus!="NoChange")
> rfwd(LETTERS,seq_along(LETTERS)%%10==0)
[1] "" "" "" "" "" "" "" "" "" "J" "J" "J" "J" "J" "J" "J" "J" "J" "J" "T" "T" "T" "T" "T" "T" "T"