Tracking the rotation sizes of NBA contenders (top 3 in conference in reg. season) as the season progresses.

rotation = number of players who play 5 or more minutes.

monthly average = average rotation size for games played within designated month.

All tables are sortable by clicking on header.

library(tidyverse)
library(nbastatR)
library(dplyr)
library(plotly)
library(tidyr)
library(reactable)
library(reactablefmtr)


Sys.setenv("VROOM_CONNECTION_SIZE" = 131072 * 2)

2023 Season

gl <- game_logs(
  seasons = 2023,
  season_types = "Regular Season",
  league = "NBA",
  result_types = "player"
)
## Acquiring NBA basic player game logs for the 2022-23 Regular Season

Denver Nuggets ’23

gl %>% filter(nameTeam == "Denver Nuggets") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "lightblue")) %>%
  layout( title = "Nuggets 2023 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl %>% filter(nameTeam == "Denver Nuggets") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Memphis Grizzlies ’23

gl %>% filter(nameTeam == "Memphis Grizzlies") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "gold")) %>%
  layout( title = "Grizzlies 2023 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "lightgrey")
gl %>% filter(nameTeam == "Memphis Grizzlies") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Sacramento Kings ’23

gl %>% filter(nameTeam == "Sacramento Kings") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "purple")) %>%
  layout( title = "Kings 2023 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "lightgrey")
gl %>% filter(nameTeam == "Sacramento Kings") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Boston Celtics ’23

gl %>% filter(nameTeam == "Boston Celtics") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "green")) %>%
  layout( title = "Celtics 2023 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "lightgrey")
gl %>% filter(nameTeam == "Boston Celtics") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Milwaukee Bucks ’23

gl %>% filter(nameTeam == "Milwaukee Bucks") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "tan")) %>%
  layout( title = "Bucks 2023 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "lightgrey")
gl %>% filter(nameTeam == "Milwaukee Bucks") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Philadelphia 76ers ’23

gl %>% filter(nameTeam == "Philadelphia 76ers") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "blue")) %>%
  layout( title = "76ers 2023 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl %>% filter(nameTeam == "Philadelphia 76ers") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

2022

gl_22 <- game_logs(
  seasons = 2022,
  season_types = "Regular Season",
  league = "NBA",
  result_types = "player"
)
## Acquiring NBA basic player game logs for the 2021-22 Regular Season

Golden State Warriors ’22

gl_22 %>% filter(nameTeam == "Golden State Warriors") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "blue")) %>%
  layout( title = "Warriors 2022 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_22 %>% filter(nameTeam == "Golden State Warriors") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Phoenix Suns ’22

gl_22 %>% filter(nameTeam == "Phoenix Suns") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "orange")) %>%
  layout( title = "Suns 2022 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_22 %>% filter(nameTeam == "Phoenix Suns") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Memphis Grizzlies ’22

gl_22 %>% filter(nameTeam == "Memphis Grizzlies") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "gold")) %>%
  layout( title = "Grizzlies 2022 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_22 %>% filter(nameTeam == "Memphis Grizzlies") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Boston Celtics ’22

gl_22 %>% filter(nameTeam == "Boston Celtics") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "green")) %>%
  layout( title = "Celtics 2022 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_22 %>% filter(nameTeam == "Boston Celtics") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Miami Heat ’22

gl_22 %>% filter(nameTeam == "Miami Heat") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "red")) %>%
  layout( title = "Heat 2022 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_22 %>% filter(nameTeam == "Miami Heat") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Milwaukee Bucks ’22

gl_22 %>% filter(nameTeam == "Milwaukee Bucks") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "tan")) %>%
  layout( title = "Bucks 2022 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_22 %>% filter(nameTeam == "Milwaukee Bucks") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

2021

gl_21 <- game_logs(
  seasons = 2021,
  season_types = "Regular Season",
  league = "NBA",
  result_types = "player"
)
## Acquiring NBA basic player game logs for the 2020-21 Regular Season

Utah Jazz ’21

gl_21 %>% filter(nameTeam == "Utah Jazz") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "yellow")) %>%
  layout( title = "Jazz 2021 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_21 %>% filter(nameTeam == "Utah Jazz") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Phoenix Suns ’21

gl_21 %>% filter(nameTeam == "Phoenix Suns") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "orange")) %>%
  layout( title = "Suns 2021 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_21 %>% filter(nameTeam == "Phoenix Suns") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Denver Nuggets ’21

gl_21 %>% filter(nameTeam == "Denver Nuggets") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "lightblue")) %>%
  layout( title = "Nuggets 2021 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_21 %>% filter(nameTeam == "Denver Nuggets") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Philadelphia 76ers ’21

gl_21 %>% filter(nameTeam == "Philadelphia 76ers") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "blue")) %>%
  layout( title = "Sixers 2021 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_21 %>% filter(nameTeam == "Philadelphia 76ers") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Brooklyn Nets ’21

gl_21 %>% filter(nameTeam == "Brooklyn Nets") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "black")) %>%
  layout( title = "Nets 2021 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_21 %>% filter(nameTeam == "Brooklyn Nets") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())

Milwaukee Bucks ’21

gl_21 %>% filter(nameTeam == "Milwaukee Bucks") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
  plot_ly( x = ~dateGame, y = ~rotation,
           type = "scatter", 
           mode = "line") %>%
  add_trace( line = list( color = "tan")) %>%
  layout( title = "Bucks 2021 Rotation",
          showlegend = FALSE,
          plot_bgcolor = "grey")
gl_21 %>% filter(nameTeam == "Milwaukee Bucks") %>%
  filter( minutes >= 5) %>%
  group_by(dateGame) %>%
  summarise(rotation = n_distinct(namePlayer)) %>%
 separate_wider_delim(dateGame,
          "-",
          names = c("year","month","day")) %>%
            group_by(month) %>%
            summarise('monthly average' = mean(rotation)) %>%
  mutate_at(vars('monthly average'), funs(round(.,2))) %>%
  reactable(theme = espn())