Learn R Programming

baseballr (version 2.0.0)

bref_daily_batter: Scrape Batter Performance Data Over a Custom Time Frame

Description

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)

Value

Returns a tibble of batter performance over the requested date range, one row per player, with the following columns:

col_nametypesdescription
bbref_idcharacterBaseball-Reference player id (slug).
seasonintegerSeason year.
NamecharacterPlayer name.
AgenumericPlayer age during the season.
LevelcharacterLeague level (e.g. Maj-AL, Maj-NL).
TeamcharacterTeam name.
GnumericGames played.
PAnumericPlate appearances.
ABnumericAt-bats.
RnumericRuns scored.
HnumericHits.
X1BnumericSingles.
X2BnumericDoubles.
X3BnumericTriples.
HRnumericHome runs.
RBInumericRuns batted in.
BBnumericWalks (bases on balls).
IBBnumericIntentional walks.
uBBnumericUnintentional walks.
SOnumericStrikeouts.
HBPnumericTimes hit by pitch.
SHnumericSacrifice hits (bunts).
SFnumericSacrifice flies.
GDPnumericGrounded into double plays.
SBnumericStolen bases.
CSnumericTimes caught stealing.
BAnumericBatting average.
OBPnumericOn-base percentage.
SLGnumericSlugging percentage.
OPSnumericOn-base plus slugging.

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"

Examples

Run this code
# \donttest{
  try(bref_daily_batter(t1="2015-05-10", t2="2015-06-20"))
# }

Run the code above in your browser using DataLab