Learn R Programming

hoopR (version 3.1.0)

cbbd_plays_game: CBD Plays by Game

Description

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

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

Get play-by-play data for a team-season from the CollegeBasketballData API.

Get play-by-play data for all games on a date from the CollegeBasketballData API.

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

Get the list of play types from the CollegeBasketballData API.

Usage

cbbd_plays_game(game_id, shooting_plays_only = FALSE)

cbbd_plays_player( player_id, season = most_recent_mbb_season(), shooting_plays_only = FALSE )

cbbd_plays_team( season = most_recent_mbb_season(), team, shooting_plays_only = FALSE )

cbbd_plays_date(date, shooting_plays_only = FALSE, utc_offset = NULL)

cbbd_plays_tournament( tournament, season = most_recent_mbb_season(), shooting_plays_only = FALSE )

cbbd_play_types()

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.

A hoopR_data tibble with one row per play (same columns as cbbd_plays_game()).

A hoopR_data tibble with one row per play (same columns as cbbd_plays_game()).

A hoopR_data tibble with one row per play (same columns as cbbd_plays_game()).

A hoopR_data tibble with one row per play (same columns as cbbd_plays_game()).

A hoopR_data tibble with one row per play type:

col_nametypesdescription
idintegerPlay type id.
namecharacterPlay type name.

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.

player_id

(integer required): Athlete id.

season

(integer required): Season, 4-digit ending-year (e.g. 2024). Defaults to most_recent_mbb_season().

team

(character required): Team name (e.g. Duke).

date

(character required): Date-time in ISO 8601 format (e.g. 2024-02-01T00:00:00.000Z).

utc_offset

(numeric optional): UTC offset (hours) for the date.

tournament

(character required): Tournament name (e.g. NCAA).

Examples

Run this code
# \donttest{
  try(cbbd_plays_game(game_id = 5881))
# }
# \donttest{
  try(cbbd_plays_player(player_id = 160, season = 2024))
# }
# \donttest{
  try(cbbd_plays_team(season = 2024, team = "Duke"))
# }
# \donttest{
  try(cbbd_plays_date(date = "2024-02-01T00:00:00.000Z"))
# }
# \donttest{
  try(cbbd_plays_tournament(tournament = "NCAA", season = 2024))
# }
# \donttest{
  try(cbbd_play_types())
# }

Run the code above in your browser using DataLab