This function allows you to scrape game logs by year for a pitcher from FanGraphs.com.
Arguments
- playerid
This is the playerid used by FanGraphs for a given player
- year
The season for which game logs should be returned (use the YYYY format)
Value
Returns a tibble of pitcher game logs with the following columns:
| col_name | types |
| PlayerName | character |
| playerid | integer |
| Date | character |
| Opp | character |
| teamid | integer |
| season | integer |
| Team | character |
| HomeAway | character |
| Age | integer |
| W | numeric |
| L | numeric |
| ERA | numeric |
| G | numeric |
| GS | numeric |
| CG | numeric |
| ShO | numeric |
| SV | numeric |
| HLD | numeric |
| BS | numeric |
| IP | numeric |
| TBF | numeric |
| H | numeric |
| R | numeric |
| ER | numeric |
| HR | numeric |
| BB | numeric |
| IBB | numeric |
| HBP | numeric |
| WP | numeric |
| BK | numeric |
| SO | numeric |
| K/9 | numeric |
| BB/9 | numeric |
| H/9 | numeric |
| K/BB | numeric |
| IFH% | numeric |
| BUH% | numeric |
| GB | numeric |
| FB | numeric |
| LD | numeric |
| IFFB | numeric |
| IFH | numeric |
| BU | numeric |
| BUH | numeric |
| K% | numeric |
| BB% | numeric |
| K-BB% | numeric |
| SIERA | numeric |
| HR/9 | numeric |
| AVG | numeric |
| WHIP | numeric |
| BABIP | numeric |
| LOB% | numeric |
| FIP | numeric |
| E-F | numeric |
| xFIP | numeric |
| ERA- | numeric |
| FIP- | numeric |
| xFIP- | numeric |
| GB/FB | numeric |
| LD% | numeric |
| GB% | numeric |
| FB% | numeric |
| IFFB% | numeric |
| HR/FB | numeric |
| RS | numeric |
| RS/9 | numeric |
| Balls | numeric |
| Strikes | numeric |
| Pitches | numeric |
| WPA | numeric |
| -WPA | numeric |
| +WPA | numeric |
| RE24 | numeric |
| REW | numeric |
| pLI | numeric |
| inLI | numeric |
| gmLI | numeric |
| exLI | numeric |
| Pulls | numeric |
| Games | numeric |
| WPA/LI | numeric |
| Clutch | numeric |
| SD | numeric |
| MD | numeric |
| FB%1 | numeric |
| FBv | numeric |
| SL% | numeric |
| SLv | numeric |
| CT% | numeric |
| CTv | numeric |
| CB% | numeric |
| CBv | numeric |
| CH% | numeric |
| CHv | numeric |
| XX% | numeric |
| PO% | numeric |
| wFB | numeric |
| wSL | numeric |
| wCT | numeric |
| wCB | numeric |
| wCH | numeric |
| wFB/C | numeric |
| wSL/C | numeric |
| wCT/C | numeric |
| wCB/C | numeric |
| wCH/C | numeric |
| O-Swing% | numeric |
| Z-Swing% | numeric |
| Swing% | numeric |
| O-Contact% | numeric |
| Z-Contact% | numeric |
| Contact% | numeric |
| Zone% | numeric |
| F-Strike% | numeric |
| SwStr% | numeric |
| Pull | numeric |
| Cent | numeric |
| Oppo | numeric |
| Soft | numeric |
| Med | numeric |
| Hard | numeric |
| bipCount | numeric |
| Pull% | numeric |
| Cent% | numeric |
| Oppo% | numeric |
| Soft% | numeric |
| Med% | numeric |
| Hard% | numeric |
| tERA | numeric |
| GSv2 | numeric |
| Events | numeric |
| gamedate | character |
| dh | integer |
Examples
# \donttest{
try(fg_pitcher_game_logs(playerid = 104, year = 2006))
#> ── MLB Pitcher Game Log data from FanGraphs.com ───── baseballr 1.2.0 ──
#> ℹ Data updated: 2022-04-30 07:15:18 UTC
#> # A tibble: 34 × 134
#> PlayerName playerid Date Opp teamid season Team HomeAway Age
#> <chr> <int> <chr> <chr> <int> <int> <chr> <chr> <int>
#> 1 Greg Maddux 104 2006-0… @SFG 22 2006 LAD A 40
#> 2 Greg Maddux 104 2006-0… @COL 22 2006 LAD A 40
#> 3 Greg Maddux 104 2006-0… PIT 22 2006 LAD H 40
#> 4 Greg Maddux 104 2006-0… SDP 22 2006 LAD H 40
#> 5 Greg Maddux 104 2006-0… @NYM 22 2006 LAD A 40
#> 6 Greg Maddux 104 2006-0… @MIL 22 2006 LAD A 40
#> 7 Greg Maddux 104 2006-0… CIN 22 2006 LAD H 40
#> 8 Greg Maddux 104 2006-0… @ARI 22 2006 LAD A 40
#> 9 Greg Maddux 104 2006-0… @SFG 22 2006 LAD A 40
#> 10 Greg Maddux 104 2006-0… SFG 22 2006 LAD H 40
#> # … with 24 more rows, and 125 more variables: W <dbl>, L <dbl>,
#> # ERA <dbl>, G <dbl>, GS <dbl>, CG <dbl>, ShO <dbl>, SV <dbl>,
#> # HLD <dbl>, BS <dbl>, IP <dbl>, TBF <dbl>, H <dbl>, R <dbl>,
#> # ER <dbl>, HR <dbl>, BB <dbl>, IBB <dbl>, HBP <dbl>, WP <dbl>,
#> # BK <dbl>, SO <dbl>, `K/9` <dbl>, `BB/9` <dbl>, `H/9` <dbl>,
#> # `K/BB` <dbl>, `IFH%` <dbl>, `BUH%` <dbl>, GB <dbl>, FB <dbl>,
#> # LD <dbl>, IFFB <dbl>, IFH <dbl>, BU <dbl>, BUH <dbl>, `K%` <dbl>, …
# }
