Skip to content

Commit

Permalink
update vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
saiemgilani committed Apr 4, 2023
1 parent 3d70cf6 commit 7fd0e7f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
27 changes: 14 additions & 13 deletions vignettes/getting-started-hoopR.Rmd
Expand Up @@ -54,7 +54,7 @@ pacman::p_load(dplyr, zoo, ggimage, gt)

### **The Data**

There are generally speaking **five** men's basketball data sources accessed from this package:
There are generally speaking **six** men's basketball data sources accessed from this package:

- [`hoopR-data` repo](https://github.com/sportsdataverse/hoopR-data) [![Twitter Follow](https://img.shields.io/twitter/follow/sportsdataverse?color=blue&label=%40sportsdataverse&logo=twitter&style=for-the-badge)](https://twitter.com/sportsdataverse)
- [NBA Stats and Data API](https://stats.nba.com)
Expand All @@ -80,22 +80,23 @@ There are generally speaking **five** men's basketball data sources accessed fro
## **Quick Start**

For the sake of your R session, we will only look at the previous 5 years of data, but I have indicated the years to which the data goes back to.
### **NBA play-by-plays (2002-2021) ~ 60-120 seconds**

### **NBA play-by-plays (2002-`r hoopR::most_recent_nba_season()`) ~ 60-120 seconds**
```{r load_nba_pbp_gs, warning = FALSE}
tictoc::tic()
progressr::with_progress({
nba_pbp <- hoopR::load_nba_pbp(2016:2021)
nba_pbp <- hoopR::load_nba_pbp(2018:hoopR::most_recent_nba_season())
})
tictoc::toc()
glue::glue("{nrow(nba_pbp)} rows of nba play-by-play data from {length(unique(nba_pbp$game_id))} games.")
dplyr::glimpse(nba_pbp)
```

### **NBA team box scores (2002-2021) ~ 5-30 seconds**
### **NBA team box scores (2002-`r hoopR::most_recent_nba_season()`) ~ 5-30 seconds**
```{r load_nba_team_gs, warning = FALSE}
tictoc::tic()
progressr::with_progress({
nba_team_box <- hoopR::load_nba_team_box(2016:2021)
nba_team_box <- hoopR::load_nba_team_box(2018:hoopR::most_recent_nba_season())
})
tictoc::toc()
Expand All @@ -104,11 +105,11 @@ glue::glue("{nrow(nba_team_box)} rows of NBA team boxscore data from {length(uni
dplyr::glimpse(nba_team_box)
```

### **NBA player box scores (2002-2021) ~ 5-30 seconds**
### **NBA player box scores (2002-`r hoopR::most_recent_nba_season()`) ~ 5-30 seconds**
```{r load_nba_player_gs, warning = FALSE}
tictoc::tic()
progressr::with_progress({
nba_player_box <- hoopR::load_nba_player_box(2016:2021)
nba_player_box <- hoopR::load_nba_player_box(2018:hoopR::most_recent_nba_season())
})
tictoc::toc()
Expand All @@ -117,36 +118,36 @@ dplyr::glimpse(nba_player_box)
```


### **Men's college basketball play-by-plays (2006-2021) ~ 120-180 seconds**
### **Men's college basketball play-by-plays (2006-`r hoopR::most_recent_mbb_season()`) ~ 120-180 seconds**

```{r load_mbb_pbp_gs, warning = FALSE}
tictoc::tic()
progressr::with_progress({
mbb_pbp <- hoopR::load_mbb_pbp(2016:2021)
mbb_pbp <- hoopR::load_mbb_pbp(2018:hoopR::most_recent_mbb_season())
})
tictoc::toc()
glue::glue("{nrow(mbb_pbp)} rows of men's college basketball play-by-play data from {length(unique(mbb_pbp$game_id))} games.")
dplyr::glimpse(mbb_pbp)
```

### **Men's college basketball team box scores (2003-2021) ~ 5-30 seconds**
### **Men's college basketball team box scores (2003-`r hoopR::most_recent_mbb_season()`) ~ 5-30 seconds**

```{r load_mbb_team_gs, warning = FALSE}
tictoc::tic()
progressr::with_progress({
mbb_team_box <- hoopR::load_mbb_team_box(2016:2021)
mbb_team_box <- hoopR::load_mbb_team_box(2018:hoopR::most_recent_mbb_season())
})
tictoc::toc()
glue::glue("{nrow(mbb_team_box)} rows of men's college basketball team boxscore data from {length(unique(mbb_team_box$game_id))} games.")
dplyr::glimpse(mbb_team_box)
```

### **Men's college basketball player box scores (2003-2021) ~ 5-30 seconds**
### **Men's college basketball player box scores (2003-`r hoopR::most_recent_mbb_season()`) ~ 5-30 seconds**

```{r load_mbb_player_gs, warning = FALSE}
tictoc::tic()
progressr::with_progress({
mbb_player_box <- hoopR::load_mbb_player_box(2016:2021)
mbb_player_box <- hoopR::load_mbb_player_box(2018:hoopR::most_recent_mbb_season())
})
tictoc::toc()
Expand Down
32 changes: 16 additions & 16 deletions vignettes/kenpom-example-functions.Rmd
Expand Up @@ -26,9 +26,9 @@ height <- kp_height(min_year = 2020, max_year = 2020)
teamstats <- kp_teamstats(min_year = 2020, max_year = 2020)
playerstats <- kp_playerstats(metric = 'eFG', conf_only = FALSE, year=2020)
playerstats <- kp_playerstats(metric = 'eFG', conf_only = FALSE, year = 2020)
kpoy <- kp_kpoy(year=2020)
kpoy <- kp_kpoy(year = 2020)
```

Expand All @@ -38,13 +38,13 @@ kpoy <- kp_kpoy(year=2020)
#---- kp_team_tables.R -------------------
team_sched <- kp_team_schedule(team = 'Florida St.', year= 2020)
team_sched <- kp_team_schedule(team = 'Florida St.', year = 2020)
gameplan <- kp_gameplan(team='Florida St.', year=2020)
gameplan <- kp_gameplan(team = 'Florida St.', year = 2020)
opptracker <- kp_opptracker(team = 'Florida St.', year=2020)
opptracker <- kp_opptracker(team = 'Florida St.', year = 2020)
team_players <- kp_team_players(team = 'Florida St.', year= 2020)
team_players <- kp_team_players(team = 'Florida St.', year = 2020)
minutes_matrix <- kp_minutes_matrix(team = 'Florida St.', year = 2020)
Expand All @@ -54,9 +54,9 @@ team_player_stats1 <- team_player_stats[[1]]
team_player_stats2 <- team_player_stats[[2]]
team_depth_chart <- kp_team_depth_chart(team = 'Florida St.', year= 2020)
team_depth_chart <- kp_team_depth_chart(team = 'Florida St.', year = 2020)
team_lineups <- kp_team_lineups(team = 'Florida St.', year= 2020)
team_lineups <- kp_team_lineups(team = 'Florida St.', year = 2020)
```

Expand All @@ -75,13 +75,13 @@ program_ratings <- kp_program_ratings()
# there anymore at the moment for all years
# records_team <- get_records_team(browser, team = 'Florida St.')
pomeroy_archive_ratings <- kp_pomeroy_archive_ratings( date='2018-11-22')
pomeroy_archive_ratings <- kp_pomeroy_archive_ratings(date = '2018-11-22')
conf <- kp_conf(year='2020',conf='ACC')
conf <- kp_conf(year = '2020',conf = 'ACC')
conf_stats <- kp_confstats(year='2020')
conf_stats <- kp_confstats(year = '2020')
conf_history <- kp_confhistory(conf='ACC')
conf_history <- kp_confhistory(conf = 'ACC')
```

Expand All @@ -92,18 +92,18 @@ conf_history <- kp_confhistory(conf='ACC')
trends <- kp_trends()
officials <- kp_officials(year= 2020)
officials <- kp_officials(year = 2020)
hca <- kp_hca()
arenas <- kp_arenas(year=2020)
arenas <- kp_arenas(year = 2020)
game_attrs <- kp_game_attrs(year=2020, attr = "Excitement")
game_attrs <- kp_game_attrs(year = 2020, attr = "Excitement")
fanmatch <- kp_fanmatch(date="2020-03-10")
fanmatch <- kp_fanmatch(date = "2020-03-10")
```
Expand Down

0 comments on commit 7fd0e7f

Please sign in to comment.