nba_team_stats: Generate summary stats for NBA players based on ESPN NBA data

Description Usage Arguments Value Examples

View source: R/nba_team_stats.R

Description

The function provides descriptive (mean, median, 25 statistic of interest (3PA, 3PM, etc) along with teams of interest (GS, HOU, etc). If positions of interest (C, PG, etc) are specified, the returned tibble depicts relevant descriptive statistics for the relevant positions in the relevant teams.

For reference on the scraped data columns information, please refer to the dataset description: https://github.com/UBC-MDS/rsketball/blob/master/dataset_description.md

For detailed use cases, please refer to the vignette: https://ubc-mds.github.io/rsketball/articles/rsketball-vignette.html

Usage

1
2
3
4
5
6
nba_team_stats(
  nba_data,
  stats_filter = c(),
  teams_filter = c(),
  positions_filter = c()
)

Arguments

nba_data

tibble of scraped ESPN NBA data

stats_filter

character vector

teams_filter

character vector

positions_filter

character vector

Value

A tibble

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
nba_data <- tibble::tibble(NAME = c("James", "Steph", "Bosh", "Klay", "Kobe"),
                          TEAM = c("MIA","MIA","MIA","GS","GS"),
                          POS = c("SF", "PG", "C", "C", "PG"),
                          PTS = c(5,4,3,2,10),
                          TO = c(1,2,3,4,3))

# Find descriptive stats for all teams without position
nba_team_stats(nba_data)

# Find specific stats (PTS, TO) for specific teams (GS, MIA) for specific positions (PG, C)
nba_team_stats(nba_data, stats_filter = c("PTS","TO"),
               teams_filter = c("GS","MIA"), positions_filter = c("C","PG"))

# Find specific stats (PTS, TO) for specific teams (GS) without positions_filter inputs
nba_team_stats(nba_data, stats_filter = c("PTS","TO"), teams_filter = c("GS"))

# Find specific stats (PTS, TO) for all individual teams (unspecified)
# for specific positions (PG, C)
nba_team_stats(nba_data, stats_filter = c("PTS","TO"), positions_filter = c("PG"))

UBC-MDS/rsketball documentation built on April 1, 2020, 4:37 a.m.