Skip to content

Commit

Permalink
global var check note
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Sep 1, 2023
1 parent 2a9f232 commit e08d4c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/helper_scrape_nfl.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ get_pbp_nfl <- function(id,
# First, create a trigger for cumsum
drive_trigger = dplyr::case_when(
# this is the first play of the first drive
is.na(dplyr::lag(driveTimeOfPossession)) & !is.na(driveTimeOfPossession) ~ 1,
is.na(dplyr::lag(.data$driveTimeOfPossession)) & !is.na(.data$driveTimeOfPossession) ~ 1,
# if driveTimeOfPossession changes, there is a new drive
dplyr::lag(driveTimeOfPossession) != driveTimeOfPossession ~ 1,
dplyr::lag(.data$driveTimeOfPossession) != .data$driveTimeOfPossession ~ 1,
TRUE ~ 0
),
# Now create the drive number by accumulationg triggers
driveSequenceNumber = cumsum(drive_trigger),
driveSequenceNumber = cumsum(.data$drive_trigger),
# driveSequenceNumber should be NA on plays where driveTimeOfPossession is NA
driveSequenceNumber = ifelse(is.na(driveTimeOfPossession), NA_real_, driveSequenceNumber),
driveSequenceNumber = ifelse(is.na(.data$driveTimeOfPossession), NA_real_, .data$driveSequenceNumber),
# drop the helper
drive_trigger = NULL
)
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ check_stat_ids <- function(seasons,
furrr::future_map_dfr(games, function(id, stats, p, dir, skip_local){
raw_data <- load_raw_game(id, dir = dir, skip_local = skip_local)
plays <- janitor::clean_names(raw_data$data$viewer$gameDetail$plays) %>%
dplyr::select("play_id", "play_stats", "desc" = play_description_with_jersey_numbers)
dplyr::select("play_id", "play_stats", "desc" = .data$play_description_with_jersey_numbers)

p(sprintf("ID=%s", as.character(id)))

Expand Down

0 comments on commit e08d4c8

Please sign in to comment.