Skip to content

Commit

Permalink
NBA Stats API (#20) (#21)
Browse files Browse the repository at this point in the history
* NBA Stats API (#20)

* utils nba stats

* update readme to exclude current issues

* Add nba_stats functions

nba_boxscore.R :
  - nba_boxscoretraditionalv2
  - nba_boxscoreadvancedv2
  - nba_boxscoreefensive
  - nba_boxscorefourfactorsv2
  - nba_boxscoremiscv2
  - nba_boxscorescoringv2
  - nba_boxscoreusagev2
  - nba_boxscoresummaryv2
  - nba_boxscorematchups
  - nba_boxscoreplayertrackv2
  - nba_boxscoresimilarityscore
  - nba_cumestatsteamgames
  - nba_cumestatsteam
  - nba_cumestatsplayergames
  - nba_cumestatsplayer
  - nba_franchisehistory
  - nba_franchiseplayers
  - nba_franchiseleaders
  - nba_alltimeleadersgrids
  - nba_assistleaders
  - nba_assisttracker
  - nba_commonallplayers
  - nba_commonplayerinfo
  - nba_commonplayoffseries
  - nba_commonteamroster
  - nba_commonteamyears
  - nba_pbp (v1 and v2)
  - nba_schedule (full season)

* Update espn_mbb_data.R

* add documentation and remaining nba functions

* documentation errors

* add to function reference

* Update NEWS.md

* Update CHANGELOG.md

* update description and readme
  • Loading branch information
saiemgilani authored Jul 26, 2021
1 parent d93d481 commit 7e6743f
Show file tree
Hide file tree
Showing 159 changed files with 19,434 additions and 59 deletions.
4 changes: 3 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ nba_pbp_db
mbb_pbp_db
^md$
^website$
^website/*
^website/*
^docs$
^docs/*
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fail-fast: false
matrix:
config:
# - {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ jobs:

- name: Install package
run: R CMD INSTALL .
- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")'
- name: Commit (amend) results of README
run: |
git add README.md
git commit -m "Rebuild README.md" || echo "No changes to commit"
git push origin --force || echo "No changes to commit"

- name: Deploy package
run: |
git config --local user.email "[email protected]"
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hoopR
Title: Functions to Access Men's Basketball Play by Play Data
Version: 1.2.0
Version: 1.3.0
Authors@R:
person(given = "Saiem",
family = "Gilani",
Expand All @@ -9,9 +9,9 @@ Authors@R:
Description: An R package to quickly obtain clean and tidy men's
basketball play by play data. The package has functions to access
live play by play and box score data from ESPN with shot locations
when available. It is also a scraping and aggregating
interface for Ken Pomeroy's men's college basketball statistics
website. It provides users with an
when available. It is also a full NBA Stats API wrapper.
It is also a scraping and aggregating interface for Ken Pomeroy's
men's college basketball statistics website. It provides users with an
active subscription to kenpom.com the capability to scrape the website tables and
analyze the data for themselves.
License: MIT + file LICENSE
Expand Down
127 changes: 127 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,133 @@ export(load_nba_player_box)
export(load_nba_schedule)
export(load_nba_team_box)
export(login)
export(nba_alltimeleadersgrids)
export(nba_assistleaders)
export(nba_assisttracker)
export(nba_boxscoreadvancedv2)
export(nba_boxscoredefensive)
export(nba_boxscorefourfactorsv2)
export(nba_boxscorematchups)
export(nba_boxscoremiscv2)
export(nba_boxscoreplayertrackv2)
export(nba_boxscorescoringv2)
export(nba_boxscoresimilarityscore)
export(nba_boxscoresummaryv2)
export(nba_boxscoretraditionalv2)
export(nba_boxscoreusagev2)
export(nba_commonallplayers)
export(nba_commonplayerinfo)
export(nba_commonplayoffseries)
export(nba_commonteamroster)
export(nba_commonteamyears)
export(nba_cumestatsplayer)
export(nba_cumestatsplayergames)
export(nba_cumestatsteam)
export(nba_cumestatsteamgames)
export(nba_defensehub)
export(nba_draftboard)
export(nba_draftcombinedrillresults)
export(nba_draftcombinenonstationaryshooting)
export(nba_draftcombineplayeranthro)
export(nba_draftcombinespotshooting)
export(nba_draftcombinestats)
export(nba_fantasywidget)
export(nba_franchisehistory)
export(nba_franchiseleaders)
export(nba_franchiseplayers)
export(nba_glalumboxscoresimilarityscore)
export(nba_homepageleaders)
export(nba_homepagev2)
export(nba_hustlestatsboxscore)
export(nba_leaderstiles)
export(nba_leaguedashlineups)
export(nba_leaguedashoppptshot)
export(nba_leaguedashplayerbiostats)
export(nba_leaguedashplayerclutch)
export(nba_leaguedashplayerptshot)
export(nba_leaguedashplayershotlocations)
export(nba_leaguedashplayerstats)
export(nba_leaguedashptdefend)
export(nba_leaguedashptstats)
export(nba_leaguedashptteamdefend)
export(nba_leaguedashteamclutch)
export(nba_leaguedashteamptshot)
export(nba_leaguedashteamshotlocations)
export(nba_leaguedashteamstats)
export(nba_leaguegamefinder)
export(nba_leaguegamelog)
export(nba_leaguehustlestatsplayer)
export(nba_leaguehustlestatsplayerleaders)
export(nba_leaguehustlestatsteam)
export(nba_leaguehustlestatsteamleaders)
export(nba_leagueleaders)
export(nba_leaguelineupviz)
export(nba_leagueplayerondetails)
export(nba_leagueseasonmatchups)
export(nba_leaguestandings)
export(nba_leaguestandingsv3)
export(nba_matchupsrollup)
export(nba_pbp)
export(nba_playerawards)
export(nba_playercareerbycollege)
export(nba_playercareerbycollegerollup)
export(nba_playercareerstats)
export(nba_playercompare)
export(nba_playerdashboardbyclutch)
export(nba_playerdashboardbygamesplits)
export(nba_playerdashboardbygeneralsplits)
export(nba_playerdashboardbylastngames)
export(nba_playerdashboardbyopponent)
export(nba_playerdashboardbyshootingsplits)
export(nba_playerdashboardbyteamperformance)
export(nba_playerdashboardbyyearoveryear)
export(nba_playerdashptpass)
export(nba_playerdashptreb)
export(nba_playerdashptshotdefend)
export(nba_playerdashptshots)
export(nba_playerestimatedmetrics)
export(nba_playerfantasyprofile)
export(nba_playerfantasyprofilebargraph)
export(nba_playergamelog)
export(nba_playergamelogs)
export(nba_playergamestreakfinder)
export(nba_playernextngames)
export(nba_playerprofilev2)
export(nba_playervsplayer)
export(nba_playoffpicture)
export(nba_schedule)
export(nba_scoreboard)
export(nba_scoreboardv2)
export(nba_shotchartdetail)
export(nba_shotchartleaguewide)
export(nba_teamdashboardbyclutch)
export(nba_teamdashboardbygamesplits)
export(nba_teamdashboardbygeneralsplits)
export(nba_teamdashboardbylastngames)
export(nba_teamdashboardbyopponent)
export(nba_teamdashboardbyshootingsplits)
export(nba_teamdashboardbyteamperformance)
export(nba_teamdashboardbyyearoveryear)
export(nba_teamdashlineups)
export(nba_teamdashptpass)
export(nba_teamdashptreb)
export(nba_teamdashptshots)
export(nba_teamdetails)
export(nba_teamestimatedmetrics)
export(nba_teamgamelog)
export(nba_teamgamelogs)
export(nba_teamgamestreakfinder)
export(nba_teamhistoricalleaders)
export(nba_teaminfocommon)
export(nba_teamplayerdashboard)
export(nba_teamplayeronoffdetails)
export(nba_teamplayeronoffsummary)
export(nba_teamvsplayer)
export(nba_teamyearbyyearstats)
export(nba_videodetails)
export(nba_videoevents)
export(nba_videostatus)
export(nba_winprobabilitypbp)
export(ncaa_mbb_NET_rankings)
export(update_mbb_db)
export(update_nba_db)
Expand Down
136 changes: 136 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,139 @@
# **hoopR 1.3.0**

### **Add Full Coverage for NBA Stats API**

Adding roughly 127 functions

| Function | File Location |
|--- |--- |
| nba_alltimeleadersgrids | R/nba_stats_leaders.R |
| nba_assistleaders | R/nba_stats_leaders.R |
| nba_assisttracker | R/nba_stats_leaders.R |
| nba_boxscoreadvancedv2 | R/nba_stats_boxscore.R |
| nba_boxscoredefensive | R/nba_stats_boxscore.R |
| nba_boxscorefourfactorsv2 | R/nba_stats_boxscore.R |
| nba_boxscorematchups | R/nba_stats_boxscore.R |
| nba_boxscoremiscv2 | R/nba_stats_boxscore.R |
| nba_boxscoreplayertrackv2 | R/nba_stats_boxscore.R |
| nba_boxscorescoringv2 | R/nba_stats_boxscore.R |
| nba_boxscoresimilarityscore | R/nba_stats_boxscore.R |
| nba_boxscoresummaryv2 | R/nba_stats_boxscore.R |
| nba_boxscoretraditionalv2 | R/nba_stats_boxscore.R |
| nba_boxscoreusagev2 | R/nba_stats_boxscore.R |
| nba_commonallplayers | R/nba_stats_roster.R |
| nba_commonplayerinfo | R/nba_stats_roster.R |
| nba_commonplayoffseries | R/nba_stats_roster.R |
| nba_commonteamroster | R/nba_stats_roster.R |
| nba_commonteamyears | R/nba_stats_roster.R |
| nba_cumestatsplayer | R/nba_stats_cume.R |
| nba_cumestatsplayergames | R/nba_stats_cume.R |
| nba_cumestatsteam | R/nba_stats_cume.R |
| nba_cumestatsteamgames | R/nba_stats_cume.R |
| nba_defensehub | R/nba_stats_leaders.R |
| nba_draftboard | R/nba_stats_draft.R |
| nba_draftcombinedrillresults | R/nba_stats_draft.R |
| nba_draftcombinenonstationaryshooting | R/nba_stats_draft.R |
| nba_draftcombineplayeranthro | R/nba_stats_draft.R |
| nba_draftcombinespotshooting | R/nba_stats_draft.R |
| nba_draftcombinestats | R/nba_stats_draft.R |
| nba_fantasywidget | R/nba_stats_lineups.R |
| nba_franchisehistory | R/nba_stats_franchise.R |
| nba_franchiseleaders | R/nba_stats_franchise.R |
| nba_franchiseplayers | R/nba_stats_franchise.R |
| nba_glalumboxscoresimilarityscore | R/nba_stats_boxscore.R |
| nba_homepageleaders | R/nba_stats_leaders.R |
| nba_homepagev2 | R/nba_stats_leaders.R |
| nba_hustlestatsboxscore | R/nba_stats_boxscore.R |
| nba_leaderstiles | R/nba_stats_leaders.R |
| nba_leaguedashlineups | R/nba_stats_lineups.R |
| nba_leaguedashoppptshot | R/nba_stats_league_dash.R |
| nba_leaguedashplayerbiostats | R/nba_stats_league_dash.R |
| nba_leaguedashplayerclutch | R/nba_stats_league_dash.R |
| nba_leaguedashplayerptshot | R/nba_stats_league_dash.R |
| nba_leaguedashplayershotlocations | R/nba_stats_league_dash.R |
| nba_leaguedashplayerstats | R/nba_stats_league_dash.R |
| nba_leaguedashptdefend | R/nba_stats_league_dash.R |
| nba_leaguedashptstats | R/nba_stats_league_dash.R |
| nba_leaguedashptteamdefend | R/nba_stats_league_dash.R |
| nba_leaguedashteamclutch | R/nba_stats_league_dash.R |
| nba_leaguedashteamptshot | R/nba_stats_league_dash.R |
| nba_leaguedashteamshotlocations | R/nba_stats_league_dash.R |
| nba_leaguedashteamstats | R/nba_stats_league_dash.R |
| nba_leaguegamefinder | R/nba_stats_league.R |
| nba_leaguegamelog | R/nba_stats_league.R |
| nba_leaguehustlestatsplayer | R/nba_stats_hustle.R |
| nba_leaguehustlestatsplayerleaders | R/nba_stats_hustle.R |
| nba_leaguehustlestatsteam | R/nba_stats_hustle.R |
| nba_leaguehustlestatsteamleaders | R/nba_stats_hustle.R |
| nba_leagueleaders | R/nba_stats_leaders.R |
| nba_leaguelineupviz | R/nba_stats_lineups.R |
| nba_leagueplayerondetails | R/nba_stats_lineups.R |
| nba_leagueseasonmatchups | R/nba_stats_lineups.R |
| nba_leaguestandings | R/nba_stats_league.R |
| nba_leaguestandingsv3 | R/nba_stats_league.R |
| nba_matchupsrollup | R/nba_stats_lineups.R |
| nba_pbp | R/nba_stats_pbp.R |
| nba_playerawards | R/nba_stats_player.R |
| nba_playercareerbycollege | R/nba_stats_player.R |
| nba_playercareerbycollegerollup | R/nba_stats_player.R |
| nba_playercareerstats | R/nba_stats_player.R |
| nba_playercompare | R/nba_stats_player.R |
| nba_playerdashboardbyclutch | R/nba_stats_player_dash.R |
| nba_playerdashboardbygamesplits | R/nba_stats_player_dash.R |
| nba_playerdashboardbygeneralsplits | R/nba_stats_player_dash.R |
| nba_playerdashboardbylastngames | R/nba_stats_player_dash.R |
| nba_playerdashboardbyopponent | R/nba_stats_player_dash.R |
| nba_playerdashboardbyshootingsplits | R/nba_stats_player_dash.R |
| nba_playerdashboardbyteamperformance | R/nba_stats_player_dash.R |
| nba_playerdashboardbyyearoveryear | R/nba_stats_player_dash.R |
| nba_playerdashptpass | R/nba_stats_player_dash.R |
| nba_playerdashptreb | R/nba_stats_player_dash.R |
| nba_playerdashptshotdefend | R/nba_stats_player_dash.R |
| nba_playerdashptshots | R/nba_stats_player_dash.R |
| nba_playerestimatedmetrics | R/nba_stats_player.R |
| nba_playerfantasyprofile | R/nba_stats_player.R |
| nba_playerfantasyprofilebargraph | R/nba_stats_player.R |
| nba_playergamelog | R/nba_stats_player.R |
| nba_playergamelogs | R/nba_stats_player.R |
| nba_playergamestreakfinder | R/nba_stats_player.R |
| nba_playernextngames | R/nba_stats_player.R |
| nba_playerprofilev2 | R/nba_stats_player.R |
| nba_playervsplayer | R/nba_stats_player.R |
| nba_playoffpicture | R/nba_stats_league.R |
| nba_schedule | R/nba_stats_pbp.R |
| nba_scoreboard | R/nba_stats_scoreboard.R |
| nba_scoreboardv2 | R/nba_stats_scoreboard.R |
| nba_shotchartdetail | R/nba_stats_shotchart.R |
| nba_shotchartleaguewide | R/nba_stats_shotchart.R |
| nba_teamdashboardbyclutch | R/nba_stats_team_dash.R |
| nba_teamdashboardbygamesplits | R/nba_stats_team_dash.R |
| nba_teamdashboardbygeneralsplits | R/nba_stats_team_dash.R |
| nba_teamdashboardbylastngames | R/nba_stats_team_dash.R |
| nba_teamdashboardbyopponent | R/nba_stats_team_dash.R |
| nba_teamdashboardbyshootingsplits | R/nba_stats_team_dash.R |
| nba_teamdashboardbyteamperformance | R/nba_stats_team_dash.R |
| nba_teamdashboardbyyearoveryear | R/nba_stats_team_dash.R |
| nba_teamdashlineups | R/nba_stats_team_dash.R |
| nba_teamdashptpass | R/nba_stats_team_dash.R |
| nba_teamdashptreb | R/nba_stats_team_dash.R |
| nba_teamdashptshots | R/nba_stats_team_dash.R |
| nba_teamdetails | R/nba_stats_team.R |
| nba_teamestimatedmetrics | R/nba_stats_team.R |
| nba_teamgamelog | R/nba_stats_team.R |
| nba_teamgamelogs | R/nba_stats_team.R |
| nba_teamgamestreakfinder | R/nba_stats_team.R |
| nba_teamhistoricalleaders | R/nba_stats_team.R |
| nba_teaminfocommon | R/nba_stats_team.R |
| nba_teamplayerdashboard | R/nba_stats_team.R |
| nba_teamplayeronoffdetails | R/nba_stats_team.R |
| nba_teamplayeronoffsummary | R/nba_stats_team.R |
| nba_teamvsplayer | R/nba_stats_team.R |
| nba_teamyearbyyearstats | R/nba_stats_team.R |
| nba_videodetails | R/nba_stats_video.R |
| nba_videoevents | R/nba_stats_video.R |
| nba_videostatus | R/nba_stats_video.R |
| nba_winprobabilitypbp | R/nba_stats_scoreboard.R |

# **hoopR 1.2.0**

### **Add schedule loaders**
Expand Down
2 changes: 1 addition & 1 deletion R/espn_mbb_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ espn_mbb_game_all <- function(game_id){
homeTeamAbbrev = raw_play_df[['header']][['competitions']][['competitors']][[1]][['team']][['abbreviation']][1]
awayTeamAbbrev = raw_play_df[['header']][['competitions']][['competitors']][[1]][['team']][['abbreviation']][2]
game_date = as.Date(substr(raw_play_df[['header']][['competitions']][['date']],0,10))
#---- Team Box ------

teams_box_score_df <- jsonlite::fromJSON(jsonlite::toJSON(raw_play_df[["boxscore"]][["teams"]]),flatten=TRUE)

teams_box_score_df_2 <- teams_box_score_df[[1]][[2]] %>%
Expand Down
Loading

1 comment on commit 7e6743f

@vercel
Copy link

@vercel vercel bot commented on 7e6743f Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.