Skip to contents

Get Play-By-Play Data for NCAA Baseball Games

Usage

ncaa_pbp(
  game_info_url = NA_character_,
  game_pbp_url = NA_character_,
  raw_html_to_disk = FALSE,
  raw_html_path = "/",
  read_from_file = FALSE,
  file = NA_character_,
  ...
)

Arguments

game_info_url

The url for the game's boxscore data. This can be found using the ncaa_schedule_info function.

game_pbp_url

The url for the game's play-by-play data. This can be found using the ncaa_schedule_info function.

raw_html_to_disk

Write raw html to disk (saves as {game_pbp_id}.html in raw_html_path directory)

raw_html_path

Directory path to write raw html

read_from_file

Read from raw html on disk

file

File with full path to read raw html

...

Additional arguments passed to an underlying function like httr.

Value

A data frame with play-by-play data for an individual game.

col_nametypes
game_datecharacter
locationcharacter
attendancelogical
inningcharacter
inning_top_botcharacter
scorecharacter
battingcharacter
fieldingcharacter
descriptioncharacter
game_pbp_urlcharacter
game_pbp_idinteger

Examples

# \donttest{
  try(ncaa_pbp(game_info_url = "https://stats.ncaa.org/contests/2167178/box_score"))
#> ── NCAA Baseball Play-by-Play data from stats.ncaa.org ─────────────────
#>  Data updated: 2024-04-13 21:57:18 UTC
#> # A tibble: 95 × 12
#>    game_date  location    attendance inning inning_top_bot score batting
#>    <chr>      <chr>       <lgl>      <chr>  <chr>          <chr> <chr>  
#>  1 02/01/2022 Jefferson … NA         1      top            0-0   Millig…
#>  2 02/01/2022 Jefferson … NA         1      top            0-0   Millig…
#>  3 02/01/2022 Jefferson … NA         1      top            0-0   Millig…
#>  4 02/01/2022 Jefferson … NA         1      top            0-0   Millig…
#>  5 02/01/2022 Jefferson … NA         1      top            0-0   Millig…
#>  6 02/01/2022 Jefferson … NA         1      bot            0-0   Carson…
#>  7 02/01/2022 Jefferson … NA         1      bot            0-0   Carson…
#>  8 02/01/2022 Jefferson … NA         1      bot            0-0   Carson…
#>  9 02/01/2022 Jefferson … NA         1      bot            0-0   Carson…
#> 10 02/01/2022 Jefferson … NA         1      bot            0-0   Carson…
#> # ℹ 85 more rows
#> # ℹ 5 more variables: fielding <chr>, description <chr>, year <int>,
#> #   game_pbp_url <chr>, game_pbp_id <int>
# }