tests/testthat/test-ncaa_pbp.R

cols <- c(
  "game_date",
  "location",
  "attendance",
  "inning",
  "inning_top_bot",
  "score",
  "batting",
  "fielding",
  "description",
  "year",
  "game_pbp_url",
  "game_pbp_id"
)

test_that("NCAA PBP", {
  skip_ncaa_test()
  skip_on_cran()
  
  y <- ncaa_pbp(game_info_url = "https://stats.ncaa.org/contests/2016254/box_score")
  z <- ncaa_pbp(game_pbp_url = "https://stats.ncaa.org/game/play_by_play/5005859")
  expect_in(sort(cols), sort(colnames(y)))
  expect_s3_class(y, "data.frame")
  expect_in(sort(cols), sort(colnames(z)))
  expect_s3_class(z, "data.frame")
})

Try the baseballr package in your browser

Any scripts or data that you put into this service are public.

baseballr documentation built on Aug. 27, 2026, 1:07 a.m.