R function and data
Incorporating average of bets