AllstarFull {Lahman}R Documentation

AllstarFull table

Description

All Star appearances by players

Usage

data(AllstarFull)

Format

A data frame with 4834 observations on the following 8 variables.

playerID

Player ID code

yearID

Year

gameNum

Game number (for years in which more than one game was played)

gameID

Game ID code

teamID

Team; a factor

lgID

League; a factor with levels AL NL

GP

Game played (zero if player did not appear in game)

startingPos

If the player started, what position he played

Source

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

Examples


data(AllstarFull)

# find number of appearances by players in the All Star games
player_appearances <- with(AllstarFull, rev(sort(table(playerID))))

# How many All-Star players, in total?
length(player_appearances)
## [1] 1637

# density plot of the whole distribution
plot(density(player_appearances), main="Player appearances in All Star Games")
rug(jitter(player_appearances))

plot of chunk unnamed-chunk-1


# who has played in more than 10 ASGs?
player_appearances[player_appearances > 10]
## playerID
## aaronha01 musiast01  mayswi01 mantlmi01 willite01 ripkeca01 yastrca01 
##        25        24        24        20        19        19        18 
## robinbr01 kalinal01 carewro01 berrayo01 spahnwa01  rosepe01 smithoz01 
##        18        18        18        18        17        17        15 
## gwynnto01   foxne01 clemero01 rodriiv01 rodrial01 robinfr02 jacksre01 
##        15        15        15        14        14        14        14 
## bondsba01 benchjo01 bankser01 killeha01 jeterde01 griffke02 dimagjo01 
##        14        14        14        13        13        13        13 
## brettge01 aparilu01 winfida01 seaveto01 schmimi01 riverma01 ramirma02 
##        13        13        12        12        12        12        12 
## piazzmi01   ottme01 mcgwima01 matheed01 larkiba01 howarel01 boggswa01 
##        12        12        12        12        12        12        12 
## alomaro01 freehbi01  fiskca01 dickebi01 crandde01 clemero02 cepedor01 
##        12        11        11        11        11        11        11 
## cartega01 boyerke01 
##        11        11
hist(player_appearances[player_appearances > 10])

plot of chunk unnamed-chunk-1



# Hank Aaron's All-Star record:
subset(AllstarFull, playerID == "aaronha01")
##       playerID yearID gameNum       gameID teamID lgID GP startingPos
## 1129 aaronha01   1955       0 NLS195507120    ML1   NL  1          NA
## 1188 aaronha01   1956       0 ALS195607100    ML1   NL  1          NA
## 1229 aaronha01   1957       0 NLS195707090    ML1   NL  1           9
## 1279 aaronha01   1958       0 ALS195807080    ML1   NL  1           9
## 1370 aaronha01   1959       1 NLS195907070    ML1   NL  1           9
## 1371 aaronha01   1959       2 NLS195908030    ML1   NL  1           9
## 1488 aaronha01   1960       1 ALS196007110    ML1   NL  1           9
## 1489 aaronha01   1960       2 ALS196007130    ML1   NL  1           9
## 1617 aaronha01   1961       1 NLS196107110    ML1   NL  1          NA
## 1618 aaronha01   1961       2 ALS196107310    ML1   NL  1          NA
## 1714 aaronha01   1962       1 ALS196207100    ML1   NL  0          NA
## 1724 aaronha01   1962       2 NLS196207300    ML1   NL  1          NA
## 1785 aaronha01   1963       0 ALS196307090    ML1   NL  1           9
## 1844 aaronha01   1964       0 NLS196407070    ML1   NL  1          NA
## 1891 aaronha01   1965       0 ALS196507130    ML1   NL  1           9
## 1940 aaronha01   1966       0 NLS196607120    ATL   NL  1           7
## 1995 aaronha01   1967       0 ALS196707110    ATL   NL  1           8
## 2048 aaronha01   1968       0 NLS196807090    ATL   NL  1           9
## 2106 aaronha01   1969       0 ALS196907230    ATL   NL  1           9
## 2163 aaronha01   1970       0 NLS197007140    ATL   NL  1           9
## 2224 aaronha01   1971       0 ALS197107130    ATL   NL  1           9
## 2286 aaronha01   1972       0 NLS197207250    ATL   NL  1           9
## 2340 aaronha01   1973       0 ALS197307240    ATL   NL  1           3
## 2407 aaronha01   1974       0 NLS197407230    ATL   NL  1           9
## 2443 aaronha01   1975       0 ALS197507150    ML4   AL  1          NA

# Years that Stan Musial played in the ASG:
with(AllstarFull, yearID[playerID == "musiast01"])
##  [1] 1943 1944 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957
## [15] 1958 1959 1959 1960 1960 1961 1961 1962 1962 1963

# Starting positions he played (NA means did not start)
with(AllstarFull, startingPos[playerID == "musiast01"])
##  [1]  7  8  7 NA  7  8  3  7  8  7  9 NA  9  3  3  3 NA NA NA NA NA NA NA
## [24] NA

# All-Star rosters from the 1966 ASG
subset(AllstarFull, gameID == "NLS196607120")
##       playerID yearID gameNum       gameID teamID lgID GP startingPos
## 1908 mclaide01   1966       0 NLS196607120    DET   AL  1           1
## 1909 freehbi01   1966       0 NLS196607120    DET   AL  1           2
## 1910 scottge02   1966       0 NLS196607120    BOS   AL  1           3
## 1911 knoopbo01   1966       0 NLS196607120    CAL   AL  1           4
## 1912 robinbr01   1966       0 NLS196607120    BAL   AL  1           5
## 1913 mcauldi01   1966       0 NLS196607120    DET   AL  1           6
## 1914 robinfr02   1966       0 NLS196607120    BAL   AL  1           7
## 1915 kalinal01   1966       0 NLS196607120    DET   AL  1           8
## 1916 olivato01   1966       0 NLS196607120    MIN   AL  1           9
## 1917 barbest01   1966       0 NLS196607120    BAL   AL  0          NA
## 1918  bellga01   1966       0 NLS196607120    CLE   AL  0          NA
## 1919 etchean01   1966       0 NLS196607120    BAL   AL  0          NA
## 1920 hunteca01   1966       0 NLS196607120    KC1   AL  0          NA
## 1921 mcdowsa01   1966       0 NLS196607120    CLE   AL  0          NA
## 1922 yastrca01   1966       0 NLS196607120    BOS   AL  0          NA
## 1923  ageeto01   1966       0 NLS196607120    CHA   AL  1          NA
## 1924 batteea01   1966       0 NLS196607120    MIN   AL  1          NA
## 1925  cashno01   1966       0 NLS196607120    DET   AL  1          NA
## 1926 colavro01   1966       0 NLS196607120    CLE   AL  1          NA
## 1927 fregoji01   1966       0 NLS196607120    CAL   AL  1          NA
## 1928  kaatji01   1966       0 NLS196607120    MIN   AL  1          NA
## 1929 killeha01   1966       0 NLS196607120    MIN   AL  1          NA
## 1930 richabo01   1966       0 NLS196607120    NYA   AL  1          NA
## 1931 richepe01   1966       0 NLS196607120    WS2   AL  1          NA
## 1932 siebeso01   1966       0 NLS196607120    CLE   AL  1          NA
## 1933 stottme01   1966       0 NLS196607120    NYA   AL  1          NA
## 1934 koufasa01   1966       0 NLS196607120    LAN   NL  1           1
## 1935 torrejo01   1966       0 NLS196607120    ATL   NL  1           2
## 1936 mccovwi01   1966       0 NLS196607120    SFN   NL  1           3
## 1937 lefebji01   1966       0 NLS196607120    LAN   NL  1           4
## 1938 santoro01   1966       0 NLS196607120    CHN   NL  1           5
## 1939 cardele01   1966       0 NLS196607120    CIN   NL  1           6
## 1940 aaronha01   1966       0 NLS196607120    ATL   NL  1           7
## 1941  mayswi01   1966       0 NLS196607120    SFN   NL  1           8
## 1942 clemero01   1966       0 NLS196607120    PIT   NL  1           9
## 1943  aloufe01   1966       0 NLS196607120    ATL   NL  0          NA
## 1944 gibsobo01   1966       0 NLS196607120    SLN   NL  0          NA
## 1945 halleto01   1966       0 NLS196607120    SFN   NL  0          NA
## 1946 mccoobi01   1966       0 NLS196607120    CIN   NL  0          NA
## 1947 morgajo02   1966       0 NLS196607120    HOU   NL  0          NA
## 1948 raymocl01   1966       0 NLS196607120    HOU   NL  0          NA
## 1949 reganph01   1966       0 NLS196607120    LAN   NL  0          NA
## 1950 vealebo01   1966       0 NLS196607120    PIT   NL  0          NA
## 1951 allendi01   1966       0 NLS196607120    PHI   NL  1          NA
## 1952 bunniji01   1966       0 NLS196607120    PHI   NL  1          NA
## 1953 floodcu01   1966       0 NLS196607120    SLN   NL  1          NA
## 1954  hartji01   1966       0 NLS196607120    SFN   NL  1          NA
## 1955  huntro01   1966       0 NLS196607120    NYN   NL  1          NA
## 1956 maricju01   1966       0 NLS196607120    SFN   NL  1          NA
## 1957 mccarti01   1966       0 NLS196607120    SLN   NL  1          NA
## 1958 perryga01   1966       0 NLS196607120    SFN   NL  1          NA
## 1959 stargwi01   1966       0 NLS196607120    PIT   NL  1          NA
## 1960 willsma01   1966       0 NLS196607120    LAN   NL  1          NA

# All-Stars from the Washington Nationals
subset(AllstarFull, teamID == "WAS")
##       playerID yearID gameNum       gameID teamID lgID GP startingPos
## 4305 cordech01   2005       0 ALS200507120    WAS   NL  1          NA
## 4308 hernali01   2005       0 ALS200507120    WAS   NL  1          NA
## 4361 soriaal01   2006       0 NLS200607110    WAS   NL  1           7
## 4455 youngdm01   2007       0 NLS200707100    WAS   NL  1          NA
## 4505 guzmacr01   2008       0 ALS200807150    WAS   NL  1          NA
## 4594 zimmery01   2009       0 NLS200907140    WAS   NL  1          NA
## 4663 cappsma01   2010       0 ALS201007130    WAS   NL  1          NA
## 4733 clippty01   2011       0 NLS201107120    WAS   NL  1          NA
## 4814 gonzagi01   2012       0 ALS201207100    WAS   NL  1          NA
## 4817 harpebr03   2012       0 ALS201207100    WAS   NL  1          NA
## 4827 strasst01   2012       0 ALS201207100    WAS   NL  1          NA
## 4829 desmoia01   2012       0 ALS201207100    WAS   NL NA          NA

# Teams with the fewest All-Stars
rare <- names(which(table(AllstarFull$teamID) < 10))

# Records associated with the 'rare' teams:
# (There are two teamID typos: can you spot them?)
subset(AllstarFull, teamID %in% rare)
##       playerID yearID gameNum       gameID teamID lgID GP startingPos
## 2076 heganmi01   1969       0 ALS196907230    SE1   AL  0          NA
## 2091 minchdo01   1969       0 ALS196907230    SE1   AL  1          NA
## 4540  penaca01   2009       0 NLS200907140    TBR   AL  0          NA
## 4689 ellsbja01   2011       0 NLS201107120    BIS   AL  1          NA
## 4748 ventejo01   2011       0 NLS201107120    ARL   NL  1          NA
## 4833 stantmi03   2012       0 ALS201207100    MIA   NL NA          NA


[Package Lahman version 2.0-1 Index]