R/parse.first.down.r

parse.first.down = function(pbp, play) {
    play$first.down = FALSE
    
    first_regex = "(?<first>1st down|first down)"
    
    if (grepl(first_regex, pbp, perl=TRUE, fixed=FALSE, ignore.case=TRUE)) {
        play$first.down = TRUE
    }
    
    return(play)    
}
wrbrooks/pbp documentation built on May 4, 2019, 11:59 a.m.