Skip to contents

Grabs entire seasons of play-by-play data from the collegebasketballdata.com API for specified season(s)

Includes a roughly complete record of every tracked play in for the games in the specified seasons.

For many games with clean player substitution data, the identities of the players on the floor are included. Sometimes, substitution data is unclean, and this results in too many or too fewer players listed as being on the floor at a given time.

A primary player is identified for some plays as participants_*_1. For example, in an unassisted shot, the ID of the player taking the shot is participants_id_1. If two players are involved in a play, the initiating player is listed as participants_id_1 and the receiving player is listed as participants_id_2. If a player passes the ball to another player who makes a shot, the assisting player is listed as participants_id_1 and the shooting player is listed as participants_id_2.

Shot location data is provided where available.

The win probability for the home team at the time of each play is provided as win_probability. These are predictions provided by the collegebasketballdata.com API, not built into the package.

Usage

load_plays(seasons = most_recent_season())

Arguments

seasons

an integer or vector of integers of seasons to fetch data for. Defaults to the most recent season. Pass in TRUE to fetch all seasons.

Value

a dataframe of play-by-play data from all D1 college basketball games.

See also

https://john-b-edwards.github.io/cbbreadr/articles/dictionary_plays.html for a web version of the data dictionary

dictionary_plays for the data dictionary as bundled within the package

Issues with this data should be filed here: https://github.com/john-b-edwards/cbbd-data/issues

Examples

# \donttest{
try({ # avoid cran errors
load_plays()
})
#>           play_id on_floor_athlete_id_1 on_floor_athlete_id_2
#>             <int>                 <int>                 <int>
#>       1:        1                     3                     5
#>       2:        2                     3                     5
#>       3:        3                     3                     5
#>       4:        4                     3                     5
#>       5:        5                     3                     5
#>      ---                                                     
#> 2190193: 37561531                   116                   496
#> 2190194: 37561532                   116                   496
#> 2190195: 37561533                   116                   496
#> 2190196: 37561534                   116                   496
#> 2190197: 37561535                   116                   496
#>          on_floor_athlete_id_3 on_floor_athlete_id_4 on_floor_athlete_id_5
#>                          <int>                 <int>                 <int>
#>       1:                    23                    20                     1
#>       2:                    23                    20                     1
#>       3:                    23                    20                     1
#>       4:                    23                    20                     1
#>       5:                    23                    20                     1
#>      ---                                                                  
#> 2190193:                   124                   500                   502
#> 2190194:                   124                   500                   502
#> 2190195:                   124                   500                   502
#> 2190196:                   124                   500                   502
#> 2190197:                   124                   500                   502
#>          on_floor_athlete_id_6 on_floor_athlete_id_7 on_floor_athlete_id_8
#>                          <int>                 <int>                 <int>
#>       1:                     4                    19                    21
#>       2:                     4                    19                    21
#>       3:                     4                    19                    21
#>       4:                     4                    19                    21
#>       5:                     4                    19                    21
#>      ---                                                                  
#> 2190193:                   498                   113                   115
#> 2190194:                   498                   113                   115
#> 2190195:                   498                   113                   115
#> 2190196:                   498                   113                   115
#> 2190197:                   498                   113                   115
#>          on_floor_athlete_id_9 on_floor_athlete_id_10 on_floor_athlete_id_11
#>                          <int>                  <int>                  <int>
#>       1:                    22                      2                     NA
#>       2:                    22                      2                     NA
#>       3:                    22                      2                     NA
#>       4:                    22                      2                     NA
#>       5:                    22                      2                     NA
#>      ---                                                                    
#> 2190193:                   499                    114                     NA
#> 2190194:                   499                    114                     NA
#> 2190195:                   499                    114                     NA
#> 2190196:                   499                    114                     NA
#> 2190197:                   499                    114                     NA
#>          on_floor_athlete_id_12 on_floor_athlete_id_13 on_floor_athlete_id_14
#>                           <int>                  <int>                  <int>
#>       1:                     NA                     NA                     NA
#>       2:                     NA                     NA                     NA
#>       3:                     NA                     NA                     NA
#>       4:                     NA                     NA                     NA
#>       5:                     NA                     NA                     NA
#>      ---                                                                     
#> 2190193:                     NA                     NA                     NA
#> 2190194:                     NA                     NA                     NA
#> 2190195:                     NA                     NA                     NA
#> 2190196:                     NA                     NA                     NA
#> 2190197:                     NA                     NA                     NA
#>          on_floor_athlete_name_1 on_floor_athlete_name_2
#>                           <char>                  <char>
#>       1:       Chad Baker-Mazara             Miles Kelly
#>       2:       Chad Baker-Mazara             Miles Kelly
#>       3:       Chad Baker-Mazara             Miles Kelly
#>       4:       Chad Baker-Mazara             Miles Kelly
#>       5:       Chad Baker-Mazara             Miles Kelly
#>      ---                                                
#> 2190193:              L.J. Cryer             Alex Condon
#> 2190194:              L.J. Cryer             Alex Condon
#> 2190195:              L.J. Cryer             Alex Condon
#> 2190196:              L.J. Cryer             Alex Condon
#> 2190197:              L.J. Cryer             Alex Condon
#>          on_floor_athlete_name_3 on_floor_athlete_name_4
#>                           <char>                  <char>
#>       1:          Tyrin Lawrence              Asa Newell
#>       2:          Tyrin Lawrence              Asa Newell
#>       3:          Tyrin Lawrence              Asa Newell
#>       4:          Tyrin Lawrence              Asa Newell
#>       5:          Tyrin Lawrence              Asa Newell
#>      ---                                                
#> 2190193:         Ja'Vier Francis           Alijah Martin
#> 2190194:         Ja'Vier Francis           Alijah Martin
#> 2190195:         Ja'Vier Francis           Alijah Martin
#> 2190196:         Ja'Vier Francis           Alijah Martin
#> 2190197:         Ja'Vier Francis           Alijah Martin
#>          on_floor_athlete_name_5 on_floor_athlete_name_6
#>                           <char>                  <char>
#>       1:          Chaney Johnson            Denver Jones
#>       2:          Chaney Johnson            Denver Jones
#>       3:          Chaney Johnson            Denver Jones
#>       4:          Chaney Johnson            Denver Jones
#>       5:          Chaney Johnson            Denver Jones
#>      ---                                                
#> 2190193:            Thomas Haugh            Will Richard
#> 2190194:            Thomas Haugh            Will Richard
#> 2190195:            Thomas Haugh            Will Richard
#> 2190196:            Thomas Haugh            Will Richard
#> 2190197:            Thomas Haugh            Will Richard
#>          on_floor_athlete_name_7 on_floor_athlete_name_8
#>                           <char>                  <char>
#>       1:              RJ Godfrey               Blue Cain
#>       2:              RJ Godfrey               Blue Cain
#>       3:              RJ Godfrey               Blue Cain
#>       4:              RJ Godfrey               Blue Cain
#>       5:              RJ Godfrey               Blue Cain
#>      ---                                                
#> 2190193:           J'Wan Roberts           Emanuel Sharp
#> 2190194:           J'Wan Roberts           Emanuel Sharp
#> 2190195:           J'Wan Roberts           Emanuel Sharp
#> 2190196:           J'Wan Roberts           Emanuel Sharp
#> 2190197:           J'Wan Roberts           Emanuel Sharp
#>          on_floor_athlete_name_9 on_floor_athlete_name_10
#>                           <char>                   <char>
#>       1:        Silas Demary Jr.           Dylan Cardwell
#>       2:        Silas Demary Jr.           Dylan Cardwell
#>       3:        Silas Demary Jr.           Dylan Cardwell
#>       4:        Silas Demary Jr.           Dylan Cardwell
#>       5:        Silas Demary Jr.           Dylan Cardwell
#>      ---                                                 
#> 2190193:      Walter Clayton Jr.               Milos Uzan
#> 2190194:      Walter Clayton Jr.               Milos Uzan
#> 2190195:      Walter Clayton Jr.               Milos Uzan
#> 2190196:      Walter Clayton Jr.               Milos Uzan
#> 2190197:      Walter Clayton Jr.               Milos Uzan
#>          on_floor_athlete_name_11 on_floor_athlete_name_12
#>                            <char>                   <char>
#>       1:                     <NA>                     <NA>
#>       2:                     <NA>                     <NA>
#>       3:                     <NA>                     <NA>
#>       4:                     <NA>                     <NA>
#>       5:                     <NA>                     <NA>
#>      ---                                                  
#> 2190193:                     <NA>                     <NA>
#> 2190194:                     <NA>                     <NA>
#> 2190195:                     <NA>                     <NA>
#> 2190196:                     <NA>                     <NA>
#> 2190197:                     <NA>                     <NA>
#>          on_floor_athlete_name_13 on_floor_athlete_name_14 on_floor_team_name_1
#>                            <char>                   <char>               <char>
#>       1:                     <NA>                     <NA>               Auburn
#>       2:                     <NA>                     <NA>               Auburn
#>       3:                     <NA>                     <NA>               Auburn
#>       4:                     <NA>                     <NA>               Auburn
#>       5:                     <NA>                     <NA>               Auburn
#>      ---                                                                       
#> 2190193:                     <NA>                     <NA>              Houston
#> 2190194:                     <NA>                     <NA>              Houston
#> 2190195:                     <NA>                     <NA>              Houston
#> 2190196:                     <NA>                     <NA>              Houston
#> 2190197:                     <NA>                     <NA>              Houston
#>          on_floor_team_name_2 on_floor_team_name_3 on_floor_team_name_4
#>                        <char>               <char>               <char>
#>       1:               Auburn              Georgia              Georgia
#>       2:               Auburn              Georgia              Georgia
#>       3:               Auburn              Georgia              Georgia
#>       4:               Auburn              Georgia              Georgia
#>       5:               Auburn              Georgia              Georgia
#>      ---                                                               
#> 2190193:              Florida              Houston              Florida
#> 2190194:              Florida              Houston              Florida
#> 2190195:              Florida              Houston              Florida
#> 2190196:              Florida              Houston              Florida
#> 2190197:              Florida              Houston              Florida
#>          on_floor_team_name_5 on_floor_team_name_6 on_floor_team_name_7
#>                        <char>               <char>               <char>
#>       1:               Auburn               Auburn              Georgia
#>       2:               Auburn               Auburn              Georgia
#>       3:               Auburn               Auburn              Georgia
#>       4:               Auburn               Auburn              Georgia
#>       5:               Auburn               Auburn              Georgia
#>      ---                                                               
#> 2190193:              Florida              Florida              Houston
#> 2190194:              Florida              Florida              Houston
#> 2190195:              Florida              Florida              Houston
#> 2190196:              Florida              Florida              Houston
#> 2190197:              Florida              Florida              Houston
#>          on_floor_team_name_8 on_floor_team_name_9 on_floor_team_name_10
#>                        <char>               <char>                <char>
#>       1:              Georgia              Georgia                Auburn
#>       2:              Georgia              Georgia                Auburn
#>       3:              Georgia              Georgia                Auburn
#>       4:              Georgia              Georgia                Auburn
#>       5:              Georgia              Georgia                Auburn
#>      ---                                                                
#> 2190193:              Houston              Florida               Houston
#> 2190194:              Houston              Florida               Houston
#> 2190195:              Houston              Florida               Houston
#> 2190196:              Houston              Florida               Houston
#> 2190197:              Houston              Florida               Houston
#>          on_floor_team_name_11 on_floor_team_name_12 on_floor_team_name_13
#>                         <char>                <char>                <char>
#>       1:                  <NA>                  <NA>                  <NA>
#>       2:                  <NA>                  <NA>                  <NA>
#>       3:                  <NA>                  <NA>                  <NA>
#>       4:                  <NA>                  <NA>                  <NA>
#>       5:                  <NA>                  <NA>                  <NA>
#>      ---                                                                  
#> 2190193:                  <NA>                  <NA>                  <NA>
#> 2190194:                  <NA>                  <NA>                  <NA>
#> 2190195:                  <NA>                  <NA>                  <NA>
#> 2190196:                  <NA>                  <NA>                  <NA>
#> 2190197:                  <NA>                  <NA>                  <NA>
#>          on_floor_team_name_14 shooter_athlete_id shooter_athlete_name
#>                         <char>              <int>               <char>
#>       1:                  <NA>                  4         Denver Jones
#>       2:                  <NA>                 NA                 <NA>
#>       3:                  <NA>                 23       Tyrin Lawrence
#>       4:                  <NA>                  3    Chad Baker-Mazara
#>       5:                  <NA>                 22     Silas Demary Jr.
#>      ---                                                              
#> 2190193:                  <NA>                 NA                 <NA>
#> 2190194:                  <NA>                 NA                 <NA>
#> 2190195:                  <NA>                 NA                 <NA>
#> 2190196:                  <NA>                 NA                 <NA>
#> 2190197:                  <NA>                 NA                 <NA>
#>          shot_made    shot_range shot_assisted assist_athlete_id
#>             <lgcl>        <char>        <lgcl>             <int>
#>       1:     FALSE three_pointer         FALSE                NA
#>       2:        NA          <NA>            NA                NA
#>       3:      TRUE           rim         FALSE                NA
#>       4:      TRUE three_pointer         FALSE                NA
#>       5:     FALSE           rim         FALSE                NA
#>      ---                                                        
#> 2190193:        NA          <NA>            NA                NA
#> 2190194:        NA          <NA>            NA                NA
#> 2190195:        NA          <NA>            NA                NA
#> 2190196:        NA          <NA>            NA                NA
#> 2190197:        NA          <NA>            NA                NA
#>          assist_athlete_name shot_x_coordinate shot_y_coordinate
#>                       <char>             <num>             <int>
#>       1:                <NA>             244.4               400
#>       2:                <NA>                NA                NA
#>       3:                <NA>             874.2               225
#>       4:                <NA>             272.6               160
#>       5:                <NA>             864.8               285
#>      ---                                                        
#> 2190193:                <NA>                NA                NA
#> 2190194:                <NA>                NA                NA
#> 2190195:                <NA>                NA                NA
#> 2190196:                <NA>                NA                NA
#> 2190197:                <NA>                NA                NA
#>          primary_participant_athlete_id secondary_participant_athlete_id
#>                                   <int>                            <int>
#>       1:                              4                               NA
#>       2:                             23                               NA
#>       3:                             23                               NA
#>       4:                              3                               NA
#>       5:                             22                               NA
#>      ---                                                                
#> 2190193:                             NA                               NA
#> 2190194:                            115                               NA
#> 2190195:                            496                               NA
#> 2190196:                             NA                               NA
#> 2190197:                             NA                               NA
#>          primary_participant_athlete_name secondary_participant_athlete_name
#>                                    <char>                             <char>
#>       1:                     Denver Jones                               <NA>
#>       2:                   Tyrin Lawrence                               <NA>
#>       3:                   Tyrin Lawrence                               <NA>
#>       4:                Chad Baker-Mazara                               <NA>
#>       5:                 Silas Demary Jr.                               <NA>
#>      ---                                                                    
#> 2190193:                             <NA>                               <NA>
#> 2190194:                    Emanuel Sharp                               <NA>
#> 2190195:                      Alex Condon                               <NA>
#> 2190196:                             <NA>                               <NA>
#> 2190197:                             <NA>                               <NA>
#>          game_id game_source_id          game_start_date season season_type
#>            <int>         <char>                   <char>  <int>      <char>
#>       1:    3468      401708333 2025-01-18T13:00:00.000Z   2025     regular
#>       2:    3468      401708333 2025-01-18T13:00:00.000Z   2025     regular
#>       3:    3468      401708333 2025-01-18T13:00:00.000Z   2025     regular
#>       4:    3468      401708333 2025-01-18T13:00:00.000Z   2025     regular
#>       5:    3468      401708333 2025-01-18T13:00:00.000Z   2025     regular
#>      ---                                                                   
#> 2190193:  209751      401746082 2025-04-08T00:50:00.000Z   2025  postseason
#> 2190194:  209751      401746082 2025-04-08T00:50:00.000Z   2025  postseason
#> 2190195:  209751      401746082 2025-04-08T00:50:00.000Z   2025  postseason
#> 2190196:  209751      401746082 2025-04-08T00:50:00.000Z   2025  postseason
#> 2190197:  209751      401746082 2025-04-08T00:50:00.000Z   2025  postseason
#>          game_type tournament     play_source_id          play_type
#>             <char>     <char>             <char>             <char>
#>       1:       STD       <NA> 401708333101805601           JumpShot
#>       2:       STD       <NA> 401708333101805901  Defensive Rebound
#>       3:       STD       <NA> 401708333101806301          LayUpShot
#>       4:       STD       <NA> 401708333101809301           JumpShot
#>       5:       STD       <NA> 401708333101815601          LayUpShot
#>      ---                                                           
#> 2190193:    TRNMNT       NCAA 401746082113523348     RegularTimeOut
#> 2190194:    TRNMNT       NCAA 401746082113523349 Lost Ball Turnover
#> 2190195:    TRNMNT       NCAA 401746082113523350              Steal
#> 2190196:    TRNMNT       NCAA 401746082113523351         End Period
#> 2190197:    TRNMNT       NCAA 401746082113523352           End Game
#>          is_home_team team_id team_name conference_short_name team_seed
#>                <lgcl>   <int>    <char>                <char>     <int>
#>       1:        FALSE      16    Auburn                   SEC        NA
#>       2:         TRUE      98   Georgia                   SEC        NA
#>       3:         TRUE      98   Georgia                   SEC        NA
#>       4:        FALSE      16    Auburn                   SEC        NA
#>       5:         TRUE      98   Georgia                   SEC        NA
#>      ---                                                               
#> 2190193:         TRUE     113   Houston                Big 12        NA
#> 2190194:         TRUE     113   Houston                Big 12        NA
#> 2190195:        FALSE      87   Florida                   SEC        NA
#> 2190196:           NA      NA      <NA>                  <NA>        NA
#> 2190197:           NA      NA      <NA>                  <NA>        NA
#>          opponent_team_id opponent_name opponent_conference_short_name
#>                     <int>        <char>                         <char>
#>       1:               98       Georgia                            SEC
#>       2:               16        Auburn                            SEC
#>       3:               16        Auburn                            SEC
#>       4:               98       Georgia                            SEC
#>       5:               16        Auburn                            SEC
#>      ---                                                              
#> 2190193:               87       Florida                            SEC
#> 2190194:               87       Florida                            SEC
#> 2190195:              113       Houston                         Big 12
#> 2190196:               NA          <NA>                           <NA>
#> 2190197:               NA          <NA>                           <NA>
#>          opponent_seed home_score away_score home_win_probability period  clock
#>                  <int>      <int>      <int>                <num>  <int> <char>
#>       1:            NA          0          0                0.635      1  19:43
#>       2:            NA          0          0                0.635      1  19:40
#>       3:            NA          2          0                0.694      1  19:36
#>       4:            NA          2          3                0.603      1  19:06
#>       5:            NA          2          3                0.599      1  18:43
#>      ---                                                                       
#> 2190193:            NA         63         65                0.158      2   0:19
#> 2190194:            NA         63         65                0.159      2   0:00
#> 2190195:            NA         63         65                0.159      2   0:00
#> 2190196:            NA         63         65                0.159      2   0:00
#> 2190197:            NA         63         65                0.159      2   0:00
#>          seconds_remaining scoring_play shooting_play score_value
#>                      <int>       <lgcl>        <lgcl>       <int>
#>       1:              1183        FALSE          TRUE           3
#>       2:              1180        FALSE         FALSE           0
#>       3:              1176         TRUE          TRUE           2
#>       4:              1146         TRUE          TRUE           3
#>       5:              1123        FALSE          TRUE           2
#>      ---                                                         
#> 2190193:                19        FALSE         FALSE           0
#> 2190194:                 0        FALSE         FALSE           0
#> 2190195:                 0        FALSE         FALSE           0
#> 2190196:                 0        FALSE         FALSE           0
#> 2190197:                 0        FALSE         FALSE           0
#>                        wall_clock                                  play_text
#>                            <char>                                     <char>
#>       1: 2025-01-18T13:02:21.000Z    Denver Jones missed Three Point Jumper.
#>       2: 2025-01-18T13:02:31.000Z          Tyrin Lawrence Defensive Rebound.
#>       3: 2025-01-18T13:02:31.000Z                 Tyrin Lawrence made Layup.
#>       4: 2025-01-18T13:03:03.000Z Chad Baker-Mazara made Three Point Jumper.
#>       5: 2025-01-18T13:03:26.000Z             Silas Demary Jr. missed Layup.
#>      ---                                                                    
#> 2190193: 2025-04-08T03:07:37.000Z                            Houston Timeout
#> 2190194: 2025-04-08T03:09:46.000Z                    Emanuel Sharp Turnover.
#> 2190195: 2025-04-08T03:09:46.000Z                         Alex Condon Steal.
#> 2190196: 2025-04-08T03:10:00.000Z                            End of 2nd half
#> 2190197: 2025-04-08T03:10:04.000Z                                End of Game
#>          clean_sub_data
#>                  <lgcl>
#>       1:           TRUE
#>       2:           TRUE
#>       3:           TRUE
#>       4:           TRUE
#>       5:           TRUE
#>      ---               
#> 2190193:           TRUE
#> 2190194:           TRUE
#> 2190195:           TRUE
#> 2190196:           TRUE
#> 2190197:           TRUE
# }