
Scrape MiLB game logs for batters from FanGraphs
Source:R/fg_milb_batter_game_logs.R
fg_milb_batter_game_logs.RdThis function allows you to scrape MiLB game logs for individual batters from FanGraphs.
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_name | types |
| player_name | character |
| minor_playerid | character |
| Date | character |
| Team | character |
| Level | character |
| Opp | character |
| G | numeric |
| AB | numeric |
| PA | numeric |
| H | numeric |
| 1B | numeric |
| 2B | numeric |
| 3B | numeric |
| HR | numeric |
| R | numeric |
| RBI | numeric |
| BB | numeric |
| IBB | numeric |
| SO | numeric |
| HBP | numeric |
| SF | numeric |
| SH | numeric |
| GDP | numeric |
| SB | numeric |
| CS | numeric |
| AVG | numeric |
| BB% | numeric |
| K% | numeric |
| BB/K | numeric |
| OBP | numeric |
| SLG | numeric |
| OPS | numeric |
| ISO | numeric |
| Spd | numeric |
| BABIP | numeric |
| wRC | numeric |
| wRAA | numeric |
| wOBA | numeric |
| wRC+ | numeric |
| wBsR | numeric |
| gamedate | character |
| dh | integer |
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>
# }