get_shotchart: Download shotchart data for player

Description Usage Arguments Value Author(s) Examples

View source: R/get_shotchart.R

Description

Downloads and process NBA.com shotchart data for given player and season.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
get_shotchart(
  player_id,
  season,
  context_measure = "FGA",
  date_from = "",
  date_to = "",
  game_segment = "",
  period = "0",
  per_mode = "PerGame",
  outcome = "",
  season_type = "Regular+Season",
  season_segment = "",
  opponent_team_id = "0",
  verbose = TRUE
)

Arguments

player_id

Player's ID in NBA.com DB

season

Number of the year in which season started

context_measure

Specify which value group you want to download. c('PTS','FGA','FGM','FG_PCT','FG3M','FG3A','FG3_PCT','PF', 'EFG_PCT','TS_PCT','PTS_FB','PTS_OFF_TOV','PTS_2ND_CHANCE')

date_from

Day from which data will be collected. It is set in MM/DD/YYYY format and by default is not specified, so data is calculated for whole season.

date_to

Day to which data will be collected. It is set in MM/DD/YYYY format and by default is not specified, so data is calculated for whole season.

game_segment

Choose game half for the data. Empty string means whole game and it is set by default. c("","First Half","Overtime","Second Half")

period

Choose game period for the data. 0 means whole game and it is set by default. as.character(c(0:4))

per_mode

Specify if you want data divided per game or totals. Default parameter is "PerGame". c("PerGame","Totals")

outcome

Filter by game result. It can be a loss (L) or a win (W). By default parameter is an empty string, so both are taken into account. c("","W","L")

season_type

Choose data for preseason, regular season or postseason. Default parameter is "Regular Season". c("Regular Season","Playoffs","Pre Season","All Star")

season_segment

Choose season half for the data. Empty string means whole season and it is set by default. c("","Post All-Star","Pre All-Star")

opponent_team_id

Filter by opponent's team id from nba.com database. Default "0" means all teams.

verbose

Defalt TRUE - prints additional information

Value

Dataset containing shot information such as location on the floor, type of shot and result per player and game.

Author(s)

Patrick Chodowski, Chodowski.Patrick@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
context_measure <- c('PTS','FGA','FGM','FG_PCT','FG3M','FG3A','FG3_PCT','PF',
'EFG_PCT','TS_PCT','PTS_FB','PTS_OFF_TOV','PTS_2ND_CHANCE')
game_segment <- c('','First+Half','Overtime','Second+Half')
opponent_team_id <- 0
per_mode <- c("PerGame","Totals")[1]
period <- as.character(c(0:4))[1]
date_from <- "01/01/2017"
date_to <- "04/30/2017"
season_type <- c("Regular+Season","Playoffs","Pre+Season","All+Star")[1]
season_segment <- c("","Post+All-Star","Pre+All-Star")[1]
outcome <- c("","W","L")[1]

get_shotchart(2853,2014)

PatrickChodowski/NBAr documentation built on April 20, 2021, 10:21 p.m.