Problem: To stagger or not to stagger?

Recommendation: The evidence largely suggests that staggering your subs to leave as many starters on the floor at a time is the best strategy to optimize a team’s plus-minus in the regular season. The best lineups rarely ever have more than one sub in them. In the last two seasons, the nuggets have had just two lineups that don’t feature Jokic but have a positive plus-minus.

The major exception to this is the Utah Jazz in the ’21 season in which they had three of the six best lineups in the league.

Note: All tables are filterable, sortable (just click on column you wish to sort), and searchable

library(tidyverse)
library(readxl)
library(janitor)
library(reactable)
library(reactablefmtr)
library(rpubs)

League ’22 lineups

lineup <- read_xlsx("nba_lineup.xlsx") %>%
  clean_names()
names(lineup) <- lineup[1,]
lineup <- lineup[-1,]
lineup$MIN <- as.numeric(lineup$MIN)
lineup$`+/-` <- as.numeric(lineup$`+/-`)

lineup_100 <- lineup %>%
  select(LINEUPS,
         TEAM, 
         MIN,
         '+/-') %>%
  filter( MIN > 200)
lineup_100 %>% reactable(searchable = TRUE,
                     sortable = TRUE,
                     filterable = TRUE,
                     pagination = FALSE) %>%
  add_title("Best lineups in the League '22 season")

Best lineups in the League '22 season

Nuggets ’22 lineups

nugs_lines <- lineup %>% 
  select(LINEUPS,
         TEAM,
         MIN,
         '+/-') %>%
  filter( TEAM == "DEN",
          MIN > 50) 
nugs_lines %>% reactable(searchable = TRUE,
                     sortable = TRUE,
                     filterable = TRUE,
                     pagination = FALSE) %>%
  add_title("Nuggets best lineups '22 season")

Nuggets best lineups '22 season

League ’21 lineups

lineup_21 <- read_xlsx("lineup_21.xlsx") %>%
  clean_names()
lineup_21$min <- as.numeric(lineup_21$min)
lineup_21$x <- as.numeric(lineup_21$x)

lineup_21_100 <- lineup_21 %>%
  select(lineups,
         team, 
         min,
         x) %>%
  rename( '+/-' = x) %>%
  filter(min > 200)
lineup_21_100 %>% reactable(searchable = TRUE,
                     sortable = TRUE,
                     filterable = TRUE,
                     pagination = FALSE) %>%
  add_title("Best lineups in the League for '21 season")

Best lineups in the League for '21 season

Nuggets ’21 lineups

nugs_lines_21 <- lineup_21 %>% 
  select(lineups,
         team,
         min,
         x) %>%
  filter( team == "DEN",
          min >40) 
nugs_lines_21 %>% reactable(searchable = TRUE,
                     sortable = TRUE,
                     filterable = TRUE,
                     pagination = FALSE) %>%
  add_title("Nuggets best lineups for '21 season")

Nuggets best lineups for '21 season

Nuggets on-off table

Nuggets on/off from ’20 to ’22 * The difference between when Jokic, Murray, and MPJ are on the floor compared to bench is over 19 points. * Table is courtesy of pbpstats.com

sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur ... 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] rpubs_0.2.2         reactablefmtr_2.0.0 reactable_0.3.0    
##  [4] janitor_2.1.0       readxl_1.4.1        forcats_0.5.2      
##  [7] stringr_1.4.1       dplyr_1.0.10        purrr_0.3.4        
## [10] readr_2.1.3         tidyr_1.2.1         tibble_3.1.8       
## [13] ggplot2_3.3.6       tidyverse_1.3.2    
## 
## loaded via a namespace (and not attached):
##  [1] lubridate_1.8.0     assertthat_0.2.1    digest_0.6.29      
##  [4] utf8_1.2.2          reactR_0.4.4        R6_2.5.1           
##  [7] cellranger_1.1.0    backports_1.4.1     reprex_2.0.2       
## [10] evaluate_0.16       httr_1.4.4          pillar_1.8.1       
## [13] rlang_1.0.6         googlesheets4_1.0.1 rstudioapi_0.14    
## [16] jquerylib_0.1.4     rmarkdown_2.16      googledrive_2.0.0  
## [19] htmlwidgets_1.5.4   munsell_0.5.0       broom_1.0.1        
## [22] compiler_4.2.1      modelr_0.1.9        xfun_0.33          
## [25] pkgconfig_2.0.3     htmltools_0.5.3     tidyselect_1.1.2   
## [28] fansi_1.0.3         crayon_1.5.2        tzdb_0.3.0         
## [31] dbplyr_2.2.1        withr_2.5.0         grid_4.2.1         
## [34] jsonlite_1.8.2      gtable_0.3.1        lifecycle_1.0.2    
## [37] DBI_1.1.3           magrittr_2.0.3      scales_1.2.1       
## [40] cli_3.4.1           stringi_1.7.8       cachem_1.0.6       
## [43] fs_1.5.2            snakecase_0.11.0    xml2_1.3.3         
## [46] bslib_0.4.0         ellipsis_0.3.2      generics_0.1.3     
## [49] vctrs_0.4.2         tools_4.2.1         glue_1.6.2         
## [52] crosstalk_1.2.0     hms_1.1.2           fastmap_1.1.0      
## [55] yaml_2.3.5          colorspace_2.0-3    gargle_1.2.1       
## [58] rvest_1.0.3         knitr_1.40          haven_2.5.1        
## [61] sass_0.4.2