I need to find consecutive days from the data frame but I am having some trouble trying to find them. I tried R, Excel, and Python but still couldn't find the solution.
My data looks like this
Date PRECTOT
1982/2/1 0.1
1982/2/2 0.14
1982/2/3 0
1982/2/6 0
1982/2/7 0
1982/2/8 0
1982/2/10 0
1982/2/11 0
1982/2/12 0
1982/2/15 0.18
1982/2/16 0
1982/2/20 0.08
1982/2/21 0
1982/2/22 0
1982/2/23 0
1982/2/24 0.03
1982/2/25 0
1982/2/26 0
1982/2/27 0
1982/2/28 0
1982/3/4 0
1982/3/5 0.05
1982/3/8 0.16
1982/3/9 0
My expected output:
Date PRECTOT Consecutive
1982/2/1 0.1 3
1982/2/2 0.14
1982/2/3 0
1982/2/6 0 3
1982/2/7 0
1982/2/8 0
1982/2/10 0 3
1982/2/11 0
1982/2/12 0
1982/2/15 0.18 2
1982/2/16 0
1982/2/20 0.08 9
1982/2/21 0
1982/2/22 0
1982/2/23 0
1982/2/24 0.03
1982/2/25 0
1982/2/26 0
1982/2/27 0
1982/2/28 0
1982/3/4 0 2
1982/3/5 0.05
1982/3/8 0.16 2
1982/3/9 0
Or
Date PRECTOT Consecutive
1982/2/1 0.1 1
1982/2/2 0.14 2
1982/2/3 0 3
1982/2/6 0 1
1982/2/7 0 2
1982/2/8 0 3
1982/2/10 0 1
1982/2/11 0 2
1982/2/12 0 3
1982/2/15 0.18 1
1982/2/16 0 2
1982/2/20 0.08 1
1982/2/21 0 2
1982/2/22 0 3
1982/2/23 0 4
1982/2/24 0.03 5
1982/2/25 0 6
1982/2/26 0 7
1982/2/27 0 8
1982/2/28 0 9
1982/3/4 0 1
1982/3/5 0.05 2
1982/3/8 0.16 1
1982/3/9 0 2
Consecutive values can be formatted, all I need to find out Consecutive Values. I would like to find a solution but I don't know what to do. (R/Python/Excel)
