I want to compare previous row with current row of a column in a dataframe, and subset the higher value alone after a low value. the data is like this,
> head(counts[,c(2,10:12)],n = 10)
event_time CLD_Line1 CLD_Line2 CLD_Line3
1 2015-05-01 05:34:00 756 325 735
2 2015-05-01 05:39:00 764 330 742
3 2015-05-01 05:44:00 773 333 752
4 2015-05-01 05:49:00 775 339 764
5 2015-05-01 05:54:00 778 345 768
6 2015-05-01 05:59:00 778 345 768
7 2015-05-01 06:04:00 0 346 770
8 2015-05-01 06:09:00 3 349 4
9 2015-05-01 06:14:00 11 2 6
10 2015-05-01 06:19:00 18 7 12
any function that checks rows with previous rows of a single column i.e,checking row1 is greater than or lesser than to row2 , row2 is greater than or lesser than r3 and so on..?