Parcourir la source

include team information for player 1

George C. Privon il y a 6 ans
Parent
commit
f0baefd16b
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      code/gen_allfouls.R

+ 4 - 2
code/gen_allfouls.R

@@ -6,7 +6,7 @@ library(tidyverse)
 # with the filename as an ID column
 datafiles <- list.files("data", pattern="*_pbp.csv", full.names = FALSE)
 
-seasons <- purrr:map_df(datafiles,
+seasons <- purrr::map_df(datafiles,
                         ~read_csv(paste0("data/", .x)),
                         .id = "filename")
 
@@ -14,7 +14,9 @@ seasons <- purrr:map_df(datafiles,
 # also ensure that SCOREMARGIN is a number and create an integer gameID
 season_subset <- seasons %>%
     dplyr::select(GAME_ID, EVENTNUM, HOMEDESCRIPTION, VISITORDESCRIPTION,
-                  SCORE, SCOREMARGIN, PCTIMESTRING, PERIOD) %>%
+                  SCORE, SCOREMARGIN, PCTIMESTRING, PERIOD,
+                  PLAYER1_TEAM_ABBREVIATION, PLAYER1_TEAM_CITY,
+                  PLAYER1_TEAM_NICKNAME) %>%
     mutate(SCOREMARGIN = as.numeric(SCOREMARGIN)) %>%
     mutate(GAME_ID_INT = as.integer(GAME_ID))