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

Examples

# \donttest{
  try(fg_milb_batter_game_logs(playerid = "sa3010868", year=2021))
#> ── MiLB Batter Game Logs data from FanGraphs.com ──── baseballr 1.2.0 ──
#>  Data updated: 2022-04-30 07:15:15 UTC
#> # A tibble: 109 × 42
#>    player_name  minor_playerid Date  Team  Level Opp       G    AB    PA
#>    <chr>        <chr>          <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#>  1 Anthony Vol… sa3010868      2021… NYY   (A+)  PIT       1     4     5
#>  2 Anthony Vol… sa3010868      2021… NYY   (A+)  PIT       1     5     6
#>  3 Anthony Vol… sa3010868      2021… NYY   (A+)  PIT       1     4     4
#>  4 Anthony Vol… sa3010868      2021… NYY   (A+)  PIT       1     4     5
#>  5 Anthony Vol… sa3010868      2021… NYY   (A+)  PIT       1     3     5
#>  6 Anthony Vol… sa3010868      2021… NYY   (A+)  PIT       1     3     4
#>  7 Anthony Vol… sa3010868      2021… NYY   (A+)  NYM       1     4     5
#>  8 Anthony Vol… sa3010868      2021… NYY   (A+)  NYM       1     2     4
#>  9 Anthony Vol… sa3010868      2021… NYY   (A+)  NYM       1     4     5
#> 10 Anthony Vol… sa3010868      2021… NYY   (A+)  NYM       1     4     4
#> # … with 99 more rows, and 33 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>, dh <int>
# }