Learn R Programming

BasketballAnalyzeR

Contains data and code to accompany the book
P. Zuccolotto and M. Manisera (2020) Basketball Data Science. Applications with R. CRC Press. ISBN 9781138600799.

Developers

Marco Sandri, Paola Zuccolotto, Marica Manisera
Big and Open Data Innovation Laboratory (BODaI-Lab)
https://bodai.unibs.it/
University of Brescia, Italy

Installation

# From CRAN:
install.packages("BasketballAnalyzeR")

# From Github (development version):
install.packages("devtools")
devtools::install_github("sndmrc/BasketballAnalyzeR"")

Warning

If you want to reproduce the figures contained in the book of Zuccolotto and Manisera (2020) and if the version of your R machine is >= 3.6.0, you need to type

RNGkind(sample.kind = "Rounding")

at the beginning of your working session.

Links

https://CRAN.R-project.org/package=BasketballAnalyzeR

Visit the Basketball Analyzer website at: bdsports.unibs.it/basketballanalyzer/

Copy Link

Version

Install

install.packages('BasketballAnalyzeR')

Monthly Downloads

1,157

Version

0.8.1

License

GPL (>= 2.0)

Issues

Pull Requests

Stars

Forks

Maintainer

Marco Sandri

Last Published

October 30th, 2025

Functions in BasketballAnalyzeR (0.8.1)

barline

Draws a bar-line plot
bubbleplot

Draws a bubble plot
fourfactors

Calculates possessions, pace, offensive and defensive rating, and Four Factors
drawNBAcourt

Add lines of NBA court to an existing ggplot2 plot
is.MDSmap

Reports whether x is a 'MDSmap' object
densityplot

Computes and plots kernel density estimation of shots with respect to a concurrent variable
inequality

Inequality analysis
expectedpts

Plots expected points of shots as a function of the distance from the basket (default) or another variable
is.hclustering

Reports whether x is a 'hclustering' object
is.fourfactors

Reports whether x is a 'fourfactors' object
is.inequality

Reports whether x is a 'inequality' object.
is.kclustering

Reports whether x is a 'kclustering' object
is.simplereg

Reports whether x is a 'simplereg' object
is.variability

Reports whether x is a 'variability' object
is.assistnet

Reports whether x is a 'networkdata' object
is.corranalysis

Reports whether x is a 'corranalysis' object
plot.hclustering

Plots hierarchical clustering from a 'hclustering' object
radialprofile

Draws radial plots for player profiles
kclustering

K-means cluster analysis
plot.MDSmap

Draws two-dimensional plots for multidimensional scaling (MDS) from a 'MDSmap' object
scatterplot

Draws a scatter plot or a matrix of scatter plots
shotchart

Plots different kinds of charts based on shot coordinates
plot.simplereg

Plot simple regression from a 'simplereg' object
plot.fourfactors

Plot possessions, pace, offensive and defensive rating, and Four Factors from a 'fourfactors' object
plot.variability

Plots a variability diagram from a 'variability' object
plot.assistnet

Plots a network from a 'assistnet' object
plot.inequality

Plot Lorenz curve from a 'inequality' object
plot.kclustering

Plot k-means clustering from a 'kclustering' object
scoringprob

Plots scoring probability of shots as a function of a given variable
plot.corranalysis

Plots the correlation matrix and the correlation network from a 'corranalysis' object
simplereg

Simple linear and nonparametric regression
variability

Variability analysis
assistnet

Investigates the network of assists-shots in a team
MDSmap

Multidimensional scaling (MDS) in 2 dimensions
Tbox

Teams box scores dataset - NBA 2017-2018
PbPmanipulation

Adapts the standard file supplied by BigDataBall to the format required by BasketballAnalyzeR
CreateRadialPlot

R function CreateRadialPlot by William D. Vickers, freely downloadable from the web
TOPboxes

Calculate Team, Opponents and Players box scores (Tbox, Obox and Pbox)
corranalysis

Correlation analysis
Tadd

Tadd dataset - NBA 2017-2018
Obox

Opponents box scores dataset - NBA 2017-2018
Pbox

Players box scores dataset - NBA 2017-2018
PbP.BDB

Play-by-play dataset - NBA 2017-2018
hclustering

Agglomerative hierarchical clustering