Skip to content
NBA Data
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
data-raw
figures
man
.Rbuildignore
.gitignore
DESCRIPTION
NAMESPACE
README.md
basketballstatsR.Rproj

README.md

basketballstatsR

An R Package For Gathering and Visualizing NBA Data

Installation

You can install basketballstatsR from github as follows:

install.packages("devtools")
devtools::install_github("emilykuehler/basketballstatsR")

Functionality

This package is in development, but current functionality supports a variety of data gathering operations for NBA data. Currently, I am scraping from basketball-reference.com however, sites such as NBA.com also have interesting data so will expand there soon.

Data Gathering Functions

basic_per_game_stats: returns basic stats for given players

basic_stats_lst <- basic_per_game_stats(c('stephen curry', 'Draymond green'))

Function will return a list of dataframes. Each dataframe contains basic per game stats for the given players for each of their seasons.

player_season_totals: returns season totals for given players

Function will return a list of dataframes. Each dataframe contains basic counting stats for the given players for each of their seasons.

player_advanced_stats: returns advanced stats for given players

advanced_stats_lst <- player_advanced_stats(c('michael jordan', 'magic johnson'))

Function will return a list of dataframes. Each dataframe contains advanced stats (per year) for the given players for each of their seasons.

player_per_100poss: returns stats normalized per 100 possessions

stats_per_100_poss_lst <- player_per_100poss(c('kevin durant', 'Russell Westbrook'))

Function will return a list of dataframes where each dataframe contains basic stats normalized per 100 possessions for the given players for each of their seasons.

player_per_36mins: returns stats normalized per 36 minutes

stats_per_36mins_lst <- player_per_36mins(c('kevin durant', 'Russell Westbrook'))

Function will return a list of dataframes where each dataframe contains basic stats normalized per 36 minutes for the given players.

player_game_logs: returns game logs for given players and years

players <- c('stephen curry', 'stephen curry', 'tim hardaway')
years <- c(2015, 2016, 1992)
game_logs <- player_game_logs(players, years)

Function returns a list of dataframes where each dataframe contains gamelogs for the requested players and years.

get_triple_doubles: returns triple doubles for given player and years

triple_doubles_lst <- get_triple_doubles('russell westbrook', c(2010,2015,2016))

Function returns a list of datrames where each dataframe contains the gamelogs in which the player scored a triple double.

You can’t perform that action at this time.