The function tidy_schedules()
is meant to be a user-friendly way of getting NHL schedules,
including the final score and shot counts of completed games.
tidy_schedules( seasons_id, expand_periods = FALSE, regular = TRUE, playoffs = TRUE, tz = Sys.timezone(), keep_id = FALSE, return_datatable = getOption("tidynhl.data.table", TRUE) )
seasons_id | Character vector of the seasons ID for which the schedule will be returned. The required format is 'xxxxyyyy'. |
---|---|
expand_periods | (optional) Logical indicating if data should be expanded at the period
level. Default to |
regular | (optional) Logical indicating if the regular season schedules should be
returned. Default to |
playoffs | (optional) Logical indicating if the playoffs schedules should be returned.
Default to |
tz | (optional) Character specifying the timezone that should be used for datetime. Default to the user system time zone. |
keep_id | (optional) Logical indicating if the IDs of different dimensions should be
returned. Default to |
return_datatable | (optional) Logical indicating whether or not a data.table should be
returned. Default can be set globally with |
# Allowing large outputs for the pkgdown website options(width = 1000L) # Get the schedule of the 2019-2020 regular season and playoffs tidy_schedules("20192020")#> season_years season_type game_datetime game_status venue_name away_abbreviation away_shots away_score home_score home_shots home_abbreviation game_nbot game_shootout #> 1: 2019-20 regular 2019-10-02 23:00:00 final Scotiabank Arena OTT 26 3 5 42 TOR 0 FALSE #> 2: 2019-20 regular 2019-10-03 00:00:00 final Enterprise Center WSH 34 3 2 22 STL 1 FALSE #> 3: 2019-20 regular 2019-10-03 02:00:00 final Rogers Place VAN 33 2 3 22 EDM 0 FALSE #> 4: 2019-20 regular 2019-10-03 02:30:00 final T-Mobile Arena SJS 22 1 4 35 VGK 0 FALSE #> 5: 2019-20 regular 2019-10-03 23:00:00 final Amalie Arena FLA 37 2 5 30 TBL 0 FALSE #> --- #> 1208: 2019-20 playoffs 2020-09-22 00:00:00 final Rogers Place DAL 29 2 3 31 TBL 0 FALSE #> 1209: 2019-20 playoffs 2020-09-24 00:00:00 final Rogers Place TBL 32 5 2 24 DAL 0 FALSE #> 1210: 2019-20 playoffs 2020-09-26 00:00:00 final Rogers Place TBL 35 5 4 30 DAL 1 FALSE #> 1211: 2019-20 playoffs 2020-09-27 00:00:00 final Rogers Place DAL 33 3 2 41 TBL 2 FALSE #> 1212: 2019-20 playoffs 2020-09-29 00:00:00 final Rogers Place TBL 29 2 0 22 DAL 0 FALSE# Get the regular season periods of both the 2018-2019 and 2019-2020 seasons, keeping the IDs # and indicating game datetime with Los Angeles local time tidy_schedules( seasons_id = c("20182019", "20192020"), expand_periods = TRUE, playoffs = FALSE, tz = "America/Los_Angeles", keep_id = TRUE )#> season_id season_years season_type game_id game_datetime game_status venue_name period_number period_label period_type away_id away_abbreviation away_shots away_score home_score home_shots home_abbreviation home_id #> 1: 20182019 2018-19 regular 2018020001 2018-10-03 16:00:00 final Scotiabank Arena 1 1st regular 8 MTL 9 1 1 9 TOR 10 #> 2: 20182019 2018-19 regular 2018020001 2018-10-03 16:00:00 final Scotiabank Arena 2 2nd regular 8 MTL 12 1 1 9 TOR 10 #> 3: 20182019 2018-19 regular 2018020001 2018-10-03 16:00:00 final Scotiabank Arena 3 3rd regular 8 MTL 15 0 0 7 TOR 10 #> 4: 20182019 2018-19 regular 2018020001 2018-10-03 16:00:00 final Scotiabank Arena 4 OT overtime 8 MTL 0 0 1 1 TOR 10 #> 5: 20182019 2018-19 regular 2018020002 2018-10-03 16:30:00 final Capital One Arena 1 1st regular 6 BOS 9 0 2 13 WSH 15 #> --- #> 7749: 20192020 2019-20 regular 2019021081 2020-03-11 19:00:00 final Pepsi Center 3 3rd regular 3 NYR 12 1 0 9 COL 21 #> 7750: 20192020 2019-20 regular 2019021081 2020-03-11 19:00:00 final Pepsi Center 4 OT overtime 3 NYR 0 0 1 2 COL 21 #> 7751: 20192020 2019-20 regular 2019021082 2020-03-11 19:30:00 final STAPLES Center 1 1st regular 9 OTT 10 1 1 13 LAK 26 #> 7752: 20192020 2019-20 regular 2019021082 2020-03-11 19:30:00 final STAPLES Center 2 2nd regular 9 OTT 8 0 0 11 LAK 26 #> 7753: 20192020 2019-20 regular 2019021082 2020-03-11 19:30:00 final STAPLES Center 3 3rd regular 9 OTT 8 1 2 15 LAK 26