I would like to get a numerical vector of time intervals between goals scored by a football team
df <- data.frame(game=c(1,2,3,4,5,6,6,6,7),goaltime=c(NA,35,51,NA,NA,2,81,90,15))
NA indicates that the team did not score a goal in this game. The earliest goal you can score in the game 1
Each game has a total time of 90 minutes, so the output vector should be
c(125,106,221,79,9,15,75)
source
share