Skip to contents

This function allows you to scrape game logs by year for a pitcher from FanGraphs.com.

Usage

fg_pitcher_game_logs(playerid, year)

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_nametypes
PlayerNamecharacter
playeridinteger
Datecharacter
Oppcharacter
teamidinteger
seasoninteger
Teamcharacter
HomeAwaycharacter
Ageinteger
Wnumeric
Lnumeric
ERAnumeric
Gnumeric
GSnumeric
CGnumeric
ShOnumeric
SVnumeric
HLDnumeric
BSnumeric
IPnumeric
TBFnumeric
Hnumeric
Rnumeric
ERnumeric
HRnumeric
BBnumeric
IBBnumeric
HBPnumeric
WPnumeric
BKnumeric
SOnumeric
K/9numeric
BB/9numeric
H/9numeric
K/BBnumeric
IFH%numeric
BUH%numeric
GBnumeric
FBnumeric
LDnumeric
IFFBnumeric
IFHnumeric
BUnumeric
BUHnumeric
K%numeric
BB%numeric
K-BB%numeric
SIERAnumeric
HR/9numeric
AVGnumeric
WHIPnumeric
BABIPnumeric
LOB%numeric
FIPnumeric
E-Fnumeric
xFIPnumeric
ERA-numeric
FIP-numeric
xFIP-numeric
GB/FBnumeric
LD%numeric
GB%numeric
FB%numeric
IFFB%numeric
HR/FBnumeric
RSnumeric
RS/9numeric
Ballsnumeric
Strikesnumeric
Pitchesnumeric
WPAnumeric
-WPAnumeric
+WPAnumeric
RE24numeric
REWnumeric
pLInumeric
inLInumeric
gmLInumeric
exLInumeric
Pullsnumeric
Gamesnumeric
WPA/LInumeric
Clutchnumeric
SDnumeric
MDnumeric
FB%1numeric
FBvnumeric
SL%numeric
SLvnumeric
CT%numeric
CTvnumeric
CB%numeric
CBvnumeric
CH%numeric
CHvnumeric
XX%numeric
PO%numeric
wFBnumeric
wSLnumeric
wCTnumeric
wCBnumeric
wCHnumeric
wFB/Cnumeric
wSL/Cnumeric
wCT/Cnumeric
wCB/Cnumeric
wCH/Cnumeric
O-Swing%numeric
Z-Swing%numeric
Swing%numeric
O-Contact%numeric
Z-Contact%numeric
Contact%numeric
Zone%numeric
F-Strike%numeric
SwStr%numeric
Pullnumeric
Centnumeric
Opponumeric
Softnumeric
Mednumeric
Hardnumeric
bipCountnumeric
Pull%numeric
Cent%numeric
Oppo%numeric
Soft%numeric
Med%numeric
Hard%numeric
tERAnumeric
GSv2numeric
Eventsnumeric
gamedatecharacter
dhinteger

Examples

# \donttest{
  try(fg_pitcher_game_logs(playerid = "19755", year = 2023))
#> ── MLB Pitcher Game Log data from FanGraphs.com ───── baseballr 1.6.0 ──
#>  Data updated: 2024-04-13 21:55:06 UTC
#> # A tibble: 23 × 234
#>    PlayerName    playerid Date  Opp   teamid season Team  HomeAway   Age
#>    <chr>            <int> <chr> <chr>  <int>  <int> <chr> <chr>    <int>
#>  1 Shohei Ohtani    19755 2023… CIN        1   2023 LAA   H           28
#>  2 Shohei Ohtani    19755 2023… SFG        1   2023 LAA   H           28
#>  3 Shohei Ohtani    19755 2023… SEA        1   2023 LAA   H           28
#>  4 Shohei Ohtani    19755 2023… @DET       1   2023 LAA   A           28
#>  5 Shohei Ohtani    19755 2023… PIT        1   2023 LAA   H           28
#>  6 Shohei Ohtani    19755 2023… HOU        1   2023 LAA   H           28
#>  7 Shohei Ohtani    19755 2023… @SDP       1   2023 LAA   A           28
#>  8 Shohei Ohtani    19755 2023… CHW        1   2023 LAA   H           28
#>  9 Shohei Ohtani    19755 2023… LAD        1   2023 LAA   H           28
#> 10 Shohei Ohtani    19755 2023… @TEX       1   2023 LAA   A           28
#> # ℹ 13 more rows
#> # ℹ 225 more variables: W <dbl>, L <dbl>, ERA <dbl>, G <dbl>, GS <dbl>,
#> #   QS <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>, …
# }