Skip to content

Commit

Permalink
adding lookup and finalizing namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
benny-dreyf committed Nov 8, 2022
1 parent f3f0951 commit 99ea68c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/nfl_season_schedule.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ nfl_season_schedule<-function(year){
dplyr::select(week, day, date, time, away= winner_tie, home= loser_tie) |>
dplyr::group_by(week) |>
dplyr::group_split() |>
purrr::map(dplyr::mutate, game_num= row_number()) |>
purrr::map(dplyr::mutate, game_num= dplyr::row_number()) |>
dplyr::bind_rows() |>
tidyr::unite(col = 'game_time', date, time, sep= " ") |>
dplyr::mutate(game_time= lubridate::ymd_hm(game_time),
game_time= lubridate::as_datetime(format(game_time, format="%Y-%m-%d %I:%M:%S"))) |>
game_time= lubridate::as_datetime(format(game_time, format="%Y-%m-%d %I:%M:%S"))) |>
tidyr::pivot_longer(cols= -c('week', 'day', 'game_time', 'game_num'), names_to = 'home_away', values_to = 'team') |>
dplyr::select(week, day, game_time, game_num, home_away, team) |>
dplyr::left_join(read_csv('team_abbrev_match.csv'), by= 'team') |>
dplyr::left_join(readr::read_csv('team_abbrev_match.csv'), by= 'team') |>
dplyr::rename(team_abbrev= abrev) |>
dplyr::select(week, day, game_time, game_num, team, team_abbrev, home_away)
return(sched)
Expand Down
33 changes: 33 additions & 0 deletions team_abbrev_match.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
team,abrev
Arizona Cardinals,ARI
Atlanta Falcons,ATL
Baltimore Ravens,BAL
Buffalo Bills,BUF
Carolina Panthers,CAR
Chicago Bears,CHI
Cincinnati Bengals,CIN
Cleveland Browns,CLE
Dallas Cowboys,DAL
Denver Broncos,DEN
Detroit Lions,DET
Green Bay Packers,GB
Houston Texans,HOU
Indianapolis Colts,IND
Jacksonville Jaguars,JAC
Kansas City Chiefs,KC
Los Angeles Chargers,LAC
Los Angeles Rams,LAR
Las Vegas Raiders,LV
Miami Dolphins,MIA
Minnesota Vikings,MIN
New England Patriots,NE
New Orleans Saints,NO
New York Giants,NYG
New York Jets,NYJ
Philadelphia Eagles,PHI
Pittsburgh Steelers,PIT
Seattle Seahawks,SEA
San Francisco 49ers,SF
Tampa Bay Buccaneers,TB
Tennessee Titans,TEN
Washington Commanders,WAS

0 comments on commit 99ea68c

Please sign in to comment.