View source: R/scoredifference.R
scoredifference | R Documentation |
Computes the score difference between the two teams in the match
scoredifference(PbP_data, team_name, player_data, team_data)
PbP_data |
a play-by-play data frame, previously handled by |
team_name |
name of the team we are interested in. The name can be either shortened (e.g. CLE) or extended (e.g. Cleveland Cavaliers) |
player_data |
dataframe containing the boxscore data of all players of a particula season. We need it to know the players who have played at least one match for a team during the season. This dataframe might be substituted by a dataframe which has a column |
team_data |
dataframe, contains several data regarding the teams in the NBA. Inside this function it is used only to check if |
The score difference computed by the function can be different from the simple difference between the score of the home team and the one of the away team, as we have to take account of the points scored during an action. Indeed, the value of score.diff
indicates the difference in the score while the action was played
the initial play-by-play dataframe, with two additional columns:
score.diff
: difference between the score of team_name
and the score of the opposite team (see details
for more informations)
*isHome
: boolean which indicates if team_name
is the home team in that play-by-play row
Andrea Fox
P. Zuccolotto and M. Manisera (2020) Basketball Data Science: With Applications in R. CRC Press.
P. Zuccolotto, M. Manisera and M. Sandri (2018) Big data analytics for modeling scoring probability in basketball: The effect of shooting under high pressure conditions. International Journal of Sports Science & Coaching.
PbP <- PbPmanipulation(PbP.BDB)
PbP <- scoredifference(PbP, team_name="GSW", player_data=Pbox, team_data=Tadd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.