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

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

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)
#> # A tibble: 2 x 9 #> TEAM PTS_mean TO_mean PTS_median TO_median PTS_quantile_25 TO_quantile_25 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 GS 6 3.5 6 3.5 4 3.25 #> 2 MIA 4 2 4 2 3.5 1.5 #> # … with 2 more variables: PTS_quantile_75 <dbl>, TO_quantile_75 <dbl>
# 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"))
#> # A tibble: 4 x 10 #> # Groups: TEAM [2] #> TEAM POS PTS_mean TO_mean PTS_median TO_median PTS_quantile_25 #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 GS C 2 4 2 4 2 #> 2 GS PG 10 3 10 3 10 #> 3 MIA C 3 3 3 3 3 #> 4 MIA PG 4 2 4 2 4 #> # … with 3 more variables: TO_quantile_25 <dbl>, PTS_quantile_75 <dbl>, #> # TO_quantile_75 <dbl>
# 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"))
#> # A tibble: 1 x 9 #> TEAM PTS_mean TO_mean PTS_median TO_median PTS_quantile_25 TO_quantile_25 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 GS 6 3.5 6 3.5 4 3.25 #> # … with 2 more variables: PTS_quantile_75 <dbl>, TO_quantile_75 <dbl>
# 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"))
#> # A tibble: 2 x 10 #> # Groups: TEAM [2] #> TEAM POS PTS_mean TO_mean PTS_median TO_median PTS_quantile_25 #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 GS PG 10 3 10 3 10 #> 2 MIA PG 4 2 4 2 4 #> # … with 3 more variables: TO_quantile_25 <dbl>, PTS_quantile_75 <dbl>, #> # TO_quantile_75 <dbl>