diff --git a/R/helper_add_nflscrapr_mutations.R b/R/helper_add_nflscrapr_mutations.R index a04dbeed..e2641649 100644 --- a/R/helper_add_nflscrapr_mutations.R +++ b/R/helper_add_nflscrapr_mutations.R @@ -81,9 +81,10 @@ add_nflscrapr_mutations <- function(pbp) { .data$penalty == 1, .data$play_description %>% stringr::str_extract("(?<=PENALTY on .{1,50}, ).{1,50}(?=, [0-9]{1,2} yard)") %>% - # For some reason Face Mask penalties include the string (15 Yards) - # Seb thought it's ok to drop that with the next two lines - stringr::str_remove("\\(.+\\)") %>% + # Face Mask penalties include the yardage as string (either 5 Yards or 15 Yards) + # We remove the 15 Yards part and just keep the additional info if it's a + # 5 yard Face Mask penalty + stringr::str_remove("\\([0-9]{2}+ Yards\\)") %>% stringr::str_squish(), NA_character_ ), # Make plays marked with down == 0 as NA: