x <- read.csv("NFL Play by Play 2009-2018 (v5).csv", as.is = TRUE)
# assumes data is in working directory.
y <- x[x$qtr==1,] # keep only quarter 1.
vars <- c("play_id", "game_id", "home_team", "away_team", #"posteam",
"defteam","yardline_100","game_date","down",
"goal_to_go","ydstogo","play_type","pass_length",
"run_location","run_gap","field_goal_result",
"ep","epa")
z <- y[,colnames(y) %in% vars] # keep only these variables.
write.csv(z, "NFLQ1.csv") # saves to the working directory as a csv file.