I have the following data
With dplyr:
dplyr
library(dplyr) your_data %>% mutate( Criteria = ifelse(lag(values, 1) > 5 & lag(values, 2) > 5, 1, 0) )
1.4m articles
1.4m replys
5 comments
57.0k users