Description Usage Format Details Source Examples
Post season batting statistics
1 |
A data frame with 10900 observations on the following 22 variables.
yearIDYear
roundLevel of playoffs
playerIDPlayer ID code
teamIDTeam
lgIDLeague; a factor with levels AA AL NL
GGames
ABAt Bats
RRuns
HHits
X2BDoubles
X3BTriples
HRHomeruns
RBIRuns Batted In
SBStolen Bases
CSCaught stealing
BBBase on Balls
SOStrikeouts
IBBIntentional walks
HBPHit by pitch
SHSacrifices
SFSacrifice flies
GIDPGrounded into double plays
Variables X2B and X3B are named 2B and 3B in the original database
Lahman, S. (2014) Lahman's Baseball Database, 1871-2013, 2014 version, http://baseball1.com/statistics/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Post-season batting data
# Requires care since intra-league playoffs have evolved since 1969
# Simplest case: World Series
require(plyr)
# Create a sub-data frame for modern World Series play
ws <- subset(BattingPost, round == "WS" & yearID >= 1903)
# Add some derived measures
ws <- mutate(ws, BA = ifelse(AB == 0, 0, round(H/AB, 3)),
TB = H + X2B + 2 * X3B + 3 * HR,
SA = ifelse(AB == 0, 0, round(TB/AB, 3)),
PA = AB + BB + IBB + HBP + SH + SF,
OB = H + BB + IBB + HBP,
OBP = ifelse(AB == 0, 0, round(OB/PA, 3)) )
# Players with most appearances in the WS:
with(subset(BattingPost, round == "WS"), rev(sort(table(playerID))))[1:10]
# OK, how about someone who is *not* a Yankee?
with(subset(BattingPost, round == "WS" & teamID != "NYA"),
rev(sort(table(playerID))))[1:10]
# Top ten single WS batting averages ( >= 10 AB )
head(arrange(subset(ws, AB > 10), desc(BA)), 10)
# Top ten slugging averages in a single WS
head(arrange(subset(ws, AB > 10), desc(SA)), 10)
# Hitting stats for the 1946 St. Louis Cardinals, ordered by BA
arrange(subset(ws, teamID == "SLN" & yearID == 1946), desc(BA))
# Babe Ruth's WS profile
subset(ws, playerID == "ruthba01")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.