tests/testthat/test-fg_milb_batter_game_logs.R

cols <- c(
  "player_name",
  "minor_playerid",
  "Date",
  "Team",
  "Level",
  "Opp",
  "G",
  "AB",
  "PA",
  "H",
  "1B",
  "2B",
  "3B",
  "HR",
  "R",
  "RBI",
  "BB",
  "IBB",
  "SO",
  "HBP",
  "SF",
  "SH",
  "GDP",
  "SB",
  "CS",
  "AVG",
  "BB%",
  "K%",
  "BB/K",
  "OBP",
  "SLG",
  "OPS",
  "ISO",
  "Spd",
  "BABIP",
  "wRC",
  "wRAA",
  "wOBA",
  "wRC+",
  "wBsR",
  "gamedate",
  "dh",
  "UPId",
  "MLBAMId",
  "MinorMasterId",
  "RRId",
  "FirstName",
  "LastName",
  "firstLastName",
  "Height",
  "Weight",
  "BirthDate",
  "Bats",
  "Throws",
  "Position",
  "BirthCity",
  "College",
  "Age"
)

test_that("FanGraphs MiLB Batter Game Logs", {
  skip_on_cran()
  
  x <- fg_milb_batter_game_logs(playerid = "sa3010868", year=2021)
  
  expect_equal(colnames(x), cols)
  expect_s3_class(x, "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 April 1, 2023, 12:12 a.m.