per_player_agg: Retrieve 'per player' aggregated data

Description Usage Arguments Details Value See Also Examples

Description

Retrieve the aggregated data for each player from stats.nba.com

Usage

1
2
per_player_agg(filters = filter_per_player(), clutch = FALSE,
  measurement = "base", method = NULL, ...)

Arguments

filters

A named list of key-value filters constructed by either filter_per_player if clutch=FALSE or filter_per_player_clutch if clutch=TRUE. Full list of avaiable filters that statsnbaR recognises is given in the documentation of those two filter constructor functions.

clutch

A logical value indicating whether to extract the ‘clutch’ data, i.e. to only include plays that occurred during ‘clutch’ time in the aggregation.

measurement

A character string representing the desired dataset

base

The traditional player statistics such as field goals, rebounds, assists etc.

advanced

The advanced player statistics such as offensive and defensive ratings, effective field goal others.

miscellaneous

Miscellaneous player statistics such as points in the paint, fastbreak points, opponent points in the paint, blocks, fouls, etc.

scoring

Scoring player statistics such as the percentage of points off turnovers, in the paint, points that were assisted on etc. by that player.

usage

Usage statistics which are roughly the traditional statistics but measured as the players percentage contribution of the teams values while they are on court.

method

Optional user-supplied function to retrieve JSON from stats.nba.com

Details

Collects player 'play' statistics as averages or other aggregates over games in different units such as total values, per game values, per possession values and so forth.

The statistics are grouped into various categories which are determined by the value of the measurement argument. The categories are ‘base’, ‘advanced’, ‘miscellaneous’, ‘scoring’ and ‘usage’.

The query filters are constructed by either filter_per_player if clutch=FALSE or filter_per_player_clutch if clutch=TRUE. The list of potential filters are documented in those functions. The units that the values/data is aggregated into is determined by the per filter. The value of clutch argument is used to to plays that occured during clutch time.

Value

A data.frame containing the aggregated player data retrieved with columns converted to the data types specified by statsnbaR's internal YAML.

person_id

integer - ID of the player, used in many other datasets

player_name

character - the player's first and last name

team_id

integer - the team_id of the team the player plays for according to the season selected (see filter_bio)

team_abbr

character - abbreviated team name

age

integer - age of player in the season selected

games

numeric - games played within the selected filters

wins

numeric - wins in the player's games within the selected filters

wins

numeric - losses in the player's games within the selected filters

mins

numeric - minutes player was on court in game

All other returned columns are described in the glossary provided at http://stats.nba.com/help/glossary.

See Also

filter_per_player filter_per_player_clutch http://stats.nba.com/help/glossary

Examples

1
2
3
4
5
6
## Not run: 
  # Get data to compare clutch vs regular performance.
  ppd <- per_player_agg(filter_per_player(season=2014))
  ppdc <- per_player_agg(filter_per_player_clutch(season=2014))

## End(Not run)

stephematician/statsnbaR documentation built on May 30, 2019, 3:17 p.m.