maksimhorowitz / nflscrapR

R Package for Scraping and Aggregating NFL Data
522 stars 139 forks source link

Wrong PlayTimeDiff play association? #132

Open MrJohnnyCache opened 4 years ago

MrJohnnyCache commented 4 years ago

It appears the way season_play_by_play scrapes or calculates the PlayTimeDiff associates the previous play's time an entry later(possibly from the subtraction of the clock at a play's start time). This was observed with touchbacks and extra points having PlayTimeDiff values. I'm unsure if this is intended. I remedied this so far by shifting the PlayTimeDiff column up a row and adding it as a new column with shift <- function(x, n){ c(x[-(seq(n))], rep(NA, n)) }