Skip to contents

Get play-by-play data for a single game from the CollegeBasketballData API.

Usage

cbbd_plays_game(game_id, shooting_plays_only = FALSE)

Arguments

game_id

(integer required): CollegeBasketballData game id. See cbbd_games().

shooting_plays_only

(logical optional): If TRUE, return only shooting plays. Defaults to FALSE.

Value

A hoopR_data tibble with one row per play (key columns; shot_info is flattened to shot_info_*, participants/on_floor are list-columns):

col_nametypesdescription
idintegerPlay id.
game_idintegerGame id.
seasonnumericSeason (4-digit ending-year).
play_typecharacterPlay type description.
team_idintegerTeam id of the team on the play.
teamcharacterTeam on the play.
periodintegerPeriod number.
clockcharacterGame clock.
seconds_remainingintegerSeconds remaining in the period.
home_scoreintegerHome score after the play.
away_scoreintegerAway score after the play.
scoring_playlogicalWhether the play scored.
shooting_playlogicalWhether the play was a shot.
score_valuenumericPoint value of the play.
play_textcharacterPlay description text.

Examples

# \donttest{
  try(cbbd_plays_game(game_id = 5881))
#>  2026-06-09 22:48:22.730924: Invalid arguments or no play data available for 5881!
#>  Args: game_id = 5881, shooting_plays_only = FALSE
#>  Error: api.collegebasketballdata.com requires an API key.        See ?register_cbbd for details.
#> data frame with 0 columns and 0 rows
# }