View source: R/NBA_player_travel.R
nba_player_travel | R Documentation |
Returns a dataframe with computed travel and schedule metrics for NBA teams and each player of the team. It requires the game_logs() function from on the nbastatR package written by Bresler, A (2020) <https://github.com/abresler/nbastatR> to query season schedule information that is needed to calculate travel metrics.
nba_player_travel(
start_season = 2018,
end_season = 2020,
team = NULL,
player = NULL,
return_home = 20,
phase = c("RS", "PO"),
flight_speed = 450
)
start_season |
Numeric. The year of the season users wish to explore (i.e. 2018) |
end_season |
Numeric. The year of the final season users wish to explore (i.e. 2020) |
team |
Character String. The name of the team to be explored. If empty it defaults to all teams within the selected seasons. |
player |
Character String. The name of the player to be explored. If empty it defaults to all players in the selected query. |
return_home |
Numeric. Users can set the number of days after which the team will return home between consecutive road games. It defaults to 20 if not indicated. |
phase |
Character String. The phase of the season users wish to download. RS for Regular Season and PO for Playoffs. It defauls to both if not indicated. |
flight_speed |
Numeric. Average cruising speed (in mph) for commercial flights. Used to adjust flight time estimation. |
A data frame with the following columns:
A chracter string. The season(s) downloaded.
A character String. The phase of the season. RS (Reg Season) or PO (Play-offs).
A date. The date of the game.
A character String. The name of the team.
A character String. The name of the opponent.
A character string. Location of the game. (Home or Away)
A character string. Outcome of the game. (W or L)
A character String. The name of the city in which the game is played.
Numeric. Estimated distance travelled (in miles) prior to a game.
A character String. The route travelled for each game. If no travel involved it defaults to "No Travel".
Numeric. The number of days between games. It defaults to 15 for the first game for each team. If the team is making a "return_home" trip it will default to NA.
A character string. The time zone where the game is played.
Numeric. The time zoen change in hours.
A character string. Aproximate duration of the flight for a given trip.
A character string. Travel direction for trips involving zone changes.
A character string. If yes, team is making a "return_home" trip.
A character string. The name of the player.
Numeric. Number of rest days for the team.
Numeric. Number of rest days for each player.
Numeric. Number of games played by each player.
Numeric. Minutes played by each player.
Numeric. Points scored by each player.
nba_player_travel(start_season = 2018,
end_season = 2020,
return_home = 4,
team = "Cleveland Cavaliers",
player = "Jose Calderon")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.