Skip to contents

This function allows you to scrape basic batter statistics over a custom time frame. Data is sourced from Baseball-Reference.com.

Usage

bref_daily_batter(t1, t2)

Arguments

t1

First date data should be scraped from. Should take the form "YEAR-MONTH-DAY"

t2

Last date data should be scraped from. Should take the form "YEAR-MONTH-DAY"

Value

Returns a tibble of batter performance with the following columns:

col_nametypes
bbref_idcharacter
seasoninteger
Namecharacter
Agenumeric
Levelcharacter
Teamcharacter
Gnumeric
PAnumeric
ABnumeric
Rnumeric
Hnumeric
X1Bnumeric
X2Bnumeric
X3Bnumeric
HRnumeric
RBInumeric
BBnumeric
IBBnumeric
uBBnumeric
SOnumeric
HBPnumeric
SHnumeric
SFnumeric
GDPnumeric
SBnumeric
CSnumeric
BAnumeric
OBPnumeric
SLGnumeric
OPSnumeric

Examples

# \donttest{
  try(bref_daily_batter(t1="2015-05-10", t2="2015-06-20"))
#> ── MLB Daily Batter data from baseball-reference.com ───────────────────
#>  Data updated: 2024-01-15 11:28:14 UTC
#> # A tibble: 658 × 30
#>    bbref_id season Name    Age Level Team      G    PA    AB     R     H
#>    <chr>     <int> <chr> <dbl> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 machama…   2015 Mann…    22 Maj-… Balt…    40   175   163    30    51
#>  2 blackch…   2015 Char…    28 Maj-… Colo…    40   175   153    24    37
#>  3 kipnija…   2015 Jaso…    28 Maj-… Clev…    37   174   143    31    57
#>  4 donaljo…   2015 Josh…    29 Maj-… Toro…    39   174   155    30    45
#>  5 burnsbi…   2015 Bill…    25 Maj-… Oakl…    37   172   159    25    52
#>  6 markani…   2015 Nick…    31 Maj-… Atla…    39   172   148    14    44
#>  7 choosh01   2015 Shin…    32 Maj-… Texas    38   172   155    24    42
#>  8 gordode…   2015 Dee …    27 Maj-… Miami    38   172   168    19    49
#>  9 fowlede…   2015 Dext…    29 Maj-… Chic…    37   170   148    28    32
#> 10 goldspa…   2015 Paul…    27 Maj-… Ariz…    39   169   133    26    48
#> # ℹ 648 more rows
#> # ℹ 19 more variables: X1B <dbl>, X2B <dbl>, X3B <dbl>, HR <dbl>,
#> #   RBI <dbl>, BB <dbl>, IBB <dbl>, uBB <dbl>, SO <dbl>, HBP <dbl>,
#> #   SH <dbl>, SF <dbl>, GDP <dbl>, SB <dbl>, CS <dbl>, BA <dbl>,
#> #   OBP <dbl>, SLG <dbl>, OPS <dbl>
# }