Overview

The dataset I have chosen to load is the The Best NBA Players, According To RAPTOR

a(https://projects.fivethirtyeight.com/nba-player-ratings/)

RAPTOR is a plus-minus statistic that measures the number of points a player contributes to his team’s offense and defense per 100 possessions, relative to a league-average player.

Initial setup

Here we load all the necessary libraries

knitr::opts_chunk$set(echo = TRUE)

library(dplyr)
library(readr)

Loading data into dataframe

Obtained the permalink for the file from github and loaded the csv into a dataframe

url <- "https://projects.fivethirtyeight.com/nba-model/2023/latest_RAPTOR_by_player.csv"
nba <- read_csv(url)

Selecting the essential columns

For the purpose of this assignment we only need to look at the players defensive, offensive and total RAPTOR ratings

nba_sm <- select(nba, player_name, raptor_offense, raptor_defense, raptor_total) 

Ordering by total rating

Here we order the players in descending order of their total raptor scores

nba_inOrder <- nba_sm[order(nba_sm$raptor_total,decreasing=TRUE),]

Clean up column names

We finally clean up the column names for better clarity and list the top 20 players by total RAPTOR score

colnames(nba_inOrder) <- c("Player", "Offensive rating","Defensive rating","Total rating")
head(nba_inOrder,10)
## # A tibble: 10 × 4
##    Player           `Offensive rating` `Defensive rating` `Total rating`
##    <chr>                         <dbl>              <dbl>          <dbl>
##  1 Stanley Umude                 12.4              47.0            59.4 
##  2 Donovan Williams              23.3              20.4            43.7 
##  3 Jordan Schakel                11.8              11.3            23.0 
##  4 Tyler Dorsey                  13.7               9.14           22.8 
##  5 Nikola Jokic                   9.52              3.70           13.2 
##  6 Alize Johnson                 -4.51             15.1            10.6 
##  7 Jarrell Brantley               5.03              4.02            9.05
##  8 Dylan Windler                  2.23              5.79            8.02
##  9 Joel Embiid                    3.72              4.10            7.83
## 10 Luka Doncic                    8.27             -0.449           7.82

Unexpected results

Here we can notice that the top 4 players are rather unexpected compared to the rest of the results. This is because Raptor scores dont take into account minutes played by each player. A better result could be obtained by limiting the list to players with atleast 1000 minutes played

nba_inOrder <- nba[order(nba$raptor_total,decreasing=TRUE),]
nba_mp <- filter(select(nba_inOrder, player_name, raptor_offense, raptor_defense, raptor_total, mp), mp>1000)
colnames(nba_mp) <- c("Player", "Offensive rating","Defensive rating","Total rating","Minutes played")
head(nba_mp, 10)
## # A tibble: 10 × 5
##    Player  `Offensive rating` `Defensive rating` `Total rating` `Minutes played`
##    <chr>                <dbl>              <dbl>          <dbl>            <dbl>
##  1 Nikola…              9.52               3.70           13.2              3112
##  2 Joel E…              3.72               4.10            7.83             2620
##  3 Luka D…              8.27              -0.449           7.82             2391
##  4 Damian…              9.28              -1.47            7.82             2107
##  5 Anthon…              2.51               4.74            7.25             2512
##  6 Kawhi …              4.91               1.87            6.77             1828
##  7 Stephe…              7.48              -1.17            6.32             2434
##  8 Jimmy …              5.53               0.687           6.22             3012
##  9 Alex C…             -0.143              6.13            5.99             1575
## 10 Kyrie …              5.61               0.354           5.97             2241

Conclusion

The RAPTOR rating system gives us a detailed looked at offensive and defensive ratings througouhgt the season with extended variables that measure player performance metrics