AwardsPlayers {Lahman}R Documentation

AwardsPlayers table

Description

Award information for players awards

Usage

data(AwardsPlayers)

Format

A data frame with 5920 observations on the following 6 variables.

playerID

Player ID code

awardID

Name of award won

yearID

Year

lgID

League; a factor with levels AA AL ML NL

tie

Award was a tie (Y or N)

notes

Notes about the award

Source

Lahman, S. (2010) Lahman's Baseball Database, 1871-2012, 2012 version, http://baseball1.com/statistics/

Examples


data(AwardsPlayers)
# Which awards have been given and how many?
with(AwardsPlayers, table(awardID))
## awardID
##                            ALCS MVP                   All-Star Game MVP 
##                                  32                                  52 
##                     Babe Ruth Award          Baseball Magazine All-Star 
##                                  64                                1520 
##                 Branch Rickey Award         Comeback Player of the Year 
##                                  21                                  16 
##                      Cy Young Award                          Gold Glove 
##                                 104                                1001 
##                    Hank Aaron Award                         Hutch Award 
##                                  28                                  48 
##           Lou Gehrig Memorial Award                Most Valuable Player 
##                                  57                                 186 
##                            NLCS MVP               Pitching Triple Crown 
##                                  36                                  38 
##              Roberto Clemente Award            Rolaids Relief Man Award 
##                                  42                                  74 
##                  Rookie of the Year                      Silver Slugger 
##                                 132                                 595 
##                        Triple Crown                        TSN All-Star 
##                                  17                                1351 
##             TSN Fireman of the Year                       TSN Guide MVP 
##                                  88                                  33 
## TSN Major League Player of the Year             TSN Pitcher of the Year 
##                                  78                                 135 
##              TSN Player of the Year            TSN Reliever of the Year 
##                                  92                                  20 
##                    World Series MVP 
##                                  60
awardtab <- with(AwardsPlayers, table(awardID))
library('lattice')
## Warning: package 'lattice' was built under R version 2.15.3
dotplot(awardtab)

plot of chunk unnamed-chunk-1


# Restrict to MVP awards
mvp <- subset(AwardsPlayers, awardID == 'MVP')
# Who won in 1994?
mvp[mvp$yearID == 1994L, ]
## [1] playerID awardID  yearID   lgID     tie      notes   
## <0 rows> (or 0-length row.names)

goldglove <- subset(AwardsPlayers, awardID == 'Gold Glove')
# which players won most often?
GGcount <- table(goldglove$playerID)
GGcount[GGcount>10]
## 
## clemero01 hernake01  kaatji01 maddugr01  mayswi01 robinbr01 rodriiv01 
##        12        11        16        18        12        16        13 
## smithoz01 vizquom01 
##        13        11

# Triple Crown winners
subset(AwardsPlayers, awardID == "Triple Crown")
##       playerID      awardID yearID lgID  tie notes
## 2605 hinespa01 Triple Crown   1878   NL <NA>  <NA>
## 2606 oneilti01 Triple Crown   1887   AA <NA>  <NA>
## 2607 duffyhu01 Triple Crown   1894   NL <NA>  <NA>
## 2608 lajoina01 Triple Crown   1901   AL <NA>  <NA>
## 2609  cobbty01 Triple Crown   1909   AL <NA>  <NA>
## 2610 hornsro01 Triple Crown   1922   NL <NA>  <NA>
## 2611 hornsro01 Triple Crown   1925   NL <NA>  <NA>
## 2612  foxxji01 Triple Crown   1933   AL <NA>  <NA>
## 2613 kleinch01 Triple Crown   1933   NL <NA>  <NA>
## 2614 gehrilo01 Triple Crown   1934   AL <NA>  <NA>
## 2615 medwijo01 Triple Crown   1937   NL <NA>  <NA>
## 2616 willite01 Triple Crown   1942   AL <NA>  <NA>
## 2617 willite01 Triple Crown   1947   AL <NA>  <NA>
## 2618 mantlmi01 Triple Crown   1956   AL <NA>  <NA>
## 2619 robinfr02 Triple Crown   1966   AL <NA>  <NA>
## 2620 yastrca01 Triple Crown   1967   AL <NA>  <NA>
## 2621 cabremi01 Triple Crown   2012   NL <NA>  <NA>

# Simultaneous Triple Crown and MVP winners
# (compare merged file to TC)
TC <- subset(AwardsPlayers, awardID == "Triple Crown")
MVP <- subset(AwardsPlayers, awardID == "Most Valuable Player")
keepvars <- c("playerID", "yearID", "lgID.x")
merge(TC, MVP, by = c("playerID", "yearID"))[ ,keepvars]
##    playerID yearID lgID.x
## 1 cabremi01   2012     NL
## 2  foxxji01   1933     AL
## 3 hornsro01   1925     NL
## 4 mantlmi01   1956     AL
## 5 medwijo01   1937     NL
## 6 robinfr02   1966     AL
## 7 yastrca01   1967     AL


[Package Lahman version 2.0-1 Index]