Skip to contents

This function allows you to scrape MiLB game logs for individual batters from FanGraphs.

Usage

fg_milb_batter_game_logs(playerid, year)

Arguments

playerid

The batter's minor league ID from FanGraphs.

year

The season for which game logs should be returned.

Value

Returns a tibble of Minor League batter game logs with the following columns:

col_nametypes
player_namecharacter
minor_playeridcharacter
Datecharacter
Teamcharacter
Levelcharacter
Oppcharacter
Gnumeric
ABnumeric
PAnumeric
Hnumeric
1Bnumeric
2Bnumeric
3Bnumeric
HRnumeric
Rnumeric
RBInumeric
BBnumeric
IBBnumeric
SOnumeric
HBPnumeric
SFnumeric
SHnumeric
GDPnumeric
SBnumeric
CSnumeric
AVGnumeric
BB%numeric
K%numeric
BB/Knumeric
OBPnumeric
SLGnumeric
OPSnumeric
ISOnumeric
Spdnumeric
BABIPnumeric
wRCnumeric
wRAAnumeric
wOBAnumeric
wRC+numeric
wBsRnumeric
gamedatecharacter
dhinteger
UPIdcharacter
MLBAMIdcharacter
MinorMasterIdcharacter
RRIdcharacter
FirstNamecharacter
LastNamecharacter
firstLastNamecharacter
Heightcharacter
Weightcharacter
BirthDatecharacter
Batscharacter
Throwscharacter
Positioncharacter
BirthCitycharacter
Collegecharacter
Agecharacter

Examples

# \donttest{
  try(fg_milb_batter_game_logs(playerid = "sa3019999", year=2023))
#> ── MiLB Batter Game Logs data from FanGraphs.com ──── baseballr 1.6.0 ──
#>  Data updated: 2024-04-13 21:55:04 UTC
#> # A tibble: 94 × 59
#>    player_name  minor_playerid Date  Team  Level Opp       G    AB    PA
#>    <chr>        <chr>          <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#>  1 Sterlin Tho… sa3019999      2023… COL   (AA)  @BOS      1     2     2
#>  2 Sterlin Tho… sa3019999      2023… COL   (AA)  @BOS      1     4     4
#>  3 Sterlin Tho… sa3019999      2023… COL   (AA)  @BOS      1     5     5
#>  4 Sterlin Tho… sa3019999      2023… COL   (AA)  @BOS      1     4     4
#>  5 Sterlin Tho… sa3019999      2023… COL   (AA)  @BOS      1     3     4
#>  6 Sterlin Tho… sa3019999      2023… COL   (AA)  NYM       1     4     4
#>  7 Sterlin Tho… sa3019999      2023… COL   (AA)  @NYM      1     4     5
#>  8 Sterlin Tho… sa3019999      2023… COL   (AA)  NYM       1     2     3
#>  9 Sterlin Tho… sa3019999      2023… COL   (AA)  NYM       1     4     4
#> 10 Sterlin Tho… sa3019999      2023… COL   (AA)  NYM       1     5     5
#> # ℹ 84 more rows
#> # ℹ 50 more variables: H <dbl>, `1B` <dbl>, `2B` <dbl>, `3B` <dbl>,
#> #   HR <dbl>, R <dbl>, RBI <dbl>, BB <dbl>, IBB <dbl>, SO <dbl>,
#> #   HBP <dbl>, SF <dbl>, SH <dbl>, GDP <dbl>, SB <dbl>, CS <dbl>,
#> #   AVG <dbl>, `BB%` <dbl>, `K%` <dbl>, `BB/K` <dbl>, OBP <dbl>,
#> #   SLG <dbl>, OPS <dbl>, ISO <dbl>, Spd <dbl>, BABIP <dbl>, wRC <dbl>,
#> #   wRAA <dbl>, wOBA <dbl>, `wRC+` <dbl>, wBsR <dbl>, gamedate <chr>, …
# }