tests/testthat/test-cfbd_play_stats_player.R

cols <- c(
  "play_id",
  "game_id",
  "season",
  "week",
  "team",
  "conference",
  "opponent",
  "team_score",
  "opponent_score",
  "drive_id",
  "period",
  "clock_minutes",
  "clock_seconds",
  "yards_to_goal",
  "down",
  "distance",
  "reception_player_id",
  "reception_player",
  "reception_yds",
  "completion_player_id",
  "completion_player",
  "completion_yds",
  "rush_player_id",
  "rush_player",
  "rush_yds",
  "interception_player_id",
  "interception_player",
  "interception_stat",
  "interception_thrown_player_id",
  "interception_thrown_player",
  "interception_thrown_stat",
  "touchdown_player_id",
  "touchdown_player",
  "touchdown_stat",
  "incompletion_player_id",
  "incompletion_player",
  "incompletion_stat",
  "target_player_id",
  "target_player",
  "target_stat",
  "fumble_recovered_player_id",
  "fumble_recovered_player",
  "fumble_recovered_stat",
  "fumble_forced_player_id",
  "fumble_forced_player",
  "fumble_forced_stat",
  "fumble_player_id",
  "fumble_player",
  "fumble_stat",
  "sack_player_id",
  "sack_player",
  "sack_stat",
  "sack_taken_player_id",
  "sack_taken_player",
  "sack_taken_stat",
  "pass_breakup_player_id",
  "pass_breakup_player",
  "pass_breakup_stat",
  "field_goal_attempt_player_id",
  "field_goal_attempt_player",
  "field_goal_attempt_stat",
  "field_goal_made_player_id",
  "field_goal_made_player",
  "field_goal_made_stat",
  "field_goal_missed_player_id",
  "field_goal_missed_player",
  "field_goal_missed_stat",
  "field_goal_blocked_player_id",
  "field_goal_blocked_player",
  "field_goal_blocked_stat"
)

test_that("CFB Play Stats - Player", {
  skip_on_cran()
  x <- cfbd_play_stats_player(game_id = 401012356)
  if (is.null(x) || !is.data.frame(x) || nrow(x) == 0L) {
    skip("CFBD rate-limited or returned no rows")
  }

  y <- cfbd_play_stats_player(game_id = 401110720)
  if (is.null(y) || !is.data.frame(y) || nrow(y) == 0L) {
    skip("CFBD rate-limited or returned no rows")
  }
  expect_setequal(colnames(x), cols)
  expect_setequal(colnames(y), cols)
  expect_s3_class(x, "data.frame")
  expect_s3_class(y, "data.frame")
})

Try the cfbfastR package in your browser

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

cfbfastR documentation built on Aug. 24, 2026, 5:13 p.m.