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("2015-05-10", "2015-06-20"))
#> ── MLB Daily Batter data from baseball-reference.com ───────────────────
#>  Data updated: 2022-09-09 07:37:41 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 547989     2015 Mann…    22 Maj-… Balt…    40   175   163    30    51
#>  2 554429     2015 Char…    28 Maj-… Colo…    40   175   153    24    37
#>  3 571431     2015 Jaso…    28 Maj-… Clev…    37   174   143    31    57
#>  4 346793     2015 Josh…    29 Maj-… Toro…    39   174   155    30    45
#>  5 605113     2015 Bill…    25 Maj-… Oakl…    37   172   159    25    52
#>  6 593643     2015 Nick…    31 Maj-… Atla…    39   172   148    14    44
#>  7 501659     2015 Shin…    32 Maj-… Texas    38   172   155    24    42
#>  8 475174     2015 Dee …    27 Maj-… Miami    38   172   168    19    49
#>  9 514888     2015 Dext…    29 Maj-… Chic…    37   170   148    28    32
#> 10 506693     2015 Paul…    27 Maj-… Ariz…    39   169   133    26    48
#> # … with 648 more rows, and 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>
# }