Scrape MiLB game logs for batters from FanGraphs
Source:R/fg_milb_batter_game_logs.R
fg_milb_batter_game_logs.Rd
This 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 |
UPId | character |
MLBAMId | character |
MinorMasterId | character |
RRId | character |
FirstName | character |
LastName | character |
firstLastName | character |
Height | character |
Weight | character |
BirthDate | character |
Bats | character |
Throws | character |
Position | character |
BirthCity | character |
College | character |
Age | character |
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>, …
# }