As R and analyst newbie I'm searching for the following solutions/formulas/models:

I've an amount of rows like this

```
date, value
1: date1, 0
2: date2, 1
3: date3, 5
4: date4, 2
5: date5, 2
6: date6, 0
```

Value can be from 0 to 5.

The average count (over current 231 rows) of each value is:

0: 47 = 20.35 %

1: 93 = 40.26 %

2: 67 = 29.00 %

3: 22 = 9.52 %

4: 2 = 0.87 %

5: 0 = 0.00 %

Are there any statistic functions (and how to solve it with R) to say "it's time for the next 0?".

E.g. "0" didn't happen now for 9 laps - it "must" happen "now/soon".

It happened one time that 3 zeroes came in 3 laps. And 3 times 2 zeroes in 2 laps.

The longest no-"0" happened 3-4 times with 9 to 11 laps.

I want to use the same logic for the other values (1,2,3) too - maybe combined.

In a 2nd advanced model it should be considered that the report should also say e.g. "0" and "2" are recommended for the next lap.

Any ideas? - Thanks a lot