get_shooting_dashboard: Download shooting dashboard data for Players and Teams

Description Usage Arguments Value Author(s) Examples

View source: R/get_shooting_dashboard.R

Description

Download and process NBA.com shooting dashboard data from http://stats.nba.com/players/shots-general/, http://stats.nba.com/teams/shots-shotclock/ etc.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
get_shooting_dashboard(
  season,
  type,
  general_range = "",
  shot_clock_range = "",
  dribble_range = "",
  touch_time_range = "",
  close_def_dist_range = "",
  shot_dist_range = "",
  per_mode = "PerGame",
  season_type = "Regular+Season",
  season_segment = "",
  game_segment = "",
  date_from = "",
  date_to = "",
  outcome = "",
  period = 0,
  opponent_team_id = 0,
  team_id = 0,
  verbose = TRUE
)

Arguments

season

Number of the year in which season started

type

Specify if data is for Team or Player c("Player,"Team")

general_range

= c("Overall","Catch+And+Shoot","Pullups","Less+Than+10+ft")

shot_clock_range

= c("24-22","22-18+Very+Early","18-15+Early","15-7+Average","7-4+Late","4-0+Very+Late","ShotClock+Off")

dribble_range

= c("0+Dribbles","1+Dribble","2+Dribbles","3-6+Dribbles","7++Dribbles")

touch_time_range

= c("Touch+<+2+Seconds","Touch+2-6+Seconds","Touch+6++Seconds")

close_def_dist_range

= c("0-2+Feet+-+Very+Tight","2-4+Feet+-+Tight","4-6+Feet+-+Open","6++Feet+-+Wide+Open")

shot_dist_range

= c("","> 3D10.0")

per_mode

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

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")

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")

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.

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")

period

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

opponent_team_id

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

team_id

Specifyteam id from nba.com database. Default "0" means all teams.

verbose

Defalt TRUE - prints additional information

Value

Dataset from stats.nba.com

Author(s)

Patrick Chodowski, Chodowski.Patrick@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
season <- 2016
type <- c("Player","Team")[1]
general_range <- c("Overall","Catch+And+Shoot","Pullups","Less+Than+10+ft")[1]

shot_clock_range <- c("24-22",
"22-18+Very+Early","18-15+Early","15-7+Average","7-4+Late","4-0+Very+Late","ShotClock+Off")[1]

dribble_range <- c("0+Dribbles",
                  "1+Dribble",
                  "2+Dribbles",
                  "3-6+Dribbles",
                  "7++Dribbles"
                  )[1]

touch_time_range <- c("Touch+<+2+Seconds",
                    "Touch+2-6+Seconds",
                    "Touch+6++Seconds"
                    )[1]

close_def_dist_range <- c("0-2+Feet+-+Very+Tight",
                       "2-4+Feet+-+Tight",
                       "4-6+Feet+-+Open",
                       "6++Feet+-+Wide+Open"
                       )[1]

shot_dist_range <- c("",">3D10.0")[1]
per_mode <- c("PerGame","Totals")[1]
season_type <- c("Regular+Season","Playoffs","Pre+Season","All+Star")[1]
season_segment <- c("","Post+All-Star","Pre+All-Star")[1]
game_segment <- c("","First+Half","Overtime","Second+Half")[1]
period <- 0
date_from <- "01/01/2017"
date_to <- "04/30/2017"
outcomde <- c("","W","L")[1]
opponent_team_id <- 0
team_id <- 0

df <- get_shooting_dashboard(
                                                season,
                                                type,
                                                general_range,
                                                shot_clock_range,
                                                dribble_range,
                                                touch_time_range,
                                                close_def_dist_range,
                                                shot_dist_range,
                                                per_mode,
                                                season_type,
                                                season_segment,
                                                game_segment,
                                                date_from,
                                                date_to,
                                                outcome,
                                                period,
                                                opponent_team_id,
                                                team_id
                                                )

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