AllstarFull table
AllstarFull.Rd
All Star appearances by players
Usage
data(AllstarFull)
Format
A data frame with 5673 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. (2024) Lahman's Baseball Database, 1871-2023, 2024 version, http://www.seanlahman.com/
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] 1978
# density plot of the whole distribution
plot(density(player_appearances), main="Player appearances in All Star Games")
rug(jitter(player_appearances))
# who has played in more than 10 ASGs?
player_appearances[player_appearances > 10]
#> playerID
#> mayswi01 musiast01 aaronha01 willite01 ripkeca01 mantlmi01 yastrca01 robinbr01
#> 26 24 24 19 19 19 18 18
#> kalinal01 carewro01 berrayo01 rosepe01 clemero01 spahnwa01 smithoz01 gwynnto01
#> 18 18 18 17 17 16 15 15
#> foxne01 aparilu01 rodriiv01 rodrial01 robinfr02 jeterde01 jacksre01 bondsba01
#> 15 15 14 14 14 14 14 14
#> benchjo01 bankser01 riverma01 killeha01 griffke02 dimagjo01 crandde01 cepedor01
#> 14 14 13 13 13 13 13 13
#> cabremi01 brettge01 boyerke01 winfida01 seaveto01 schmimi01 ramirma02 pujolal01
#> 13 13 13 12 12 12 12 12
#> piazzmi01 ottme01 mcgwima01 mazerbi01 matheed01 larkiba01 boggswa01 alomaro01
#> 12 12 12 12 12 12 12 12
#> troutmi01 kershcl01 howarel01 hermabi01 freehbi01 fiskca01 dickebi01 clemero02
#> 11 11 11 11 11 11 11 11
#> cartega01
#> 11
hist(player_appearances[player_appearances > 10])
# Hank Aaron's All-Star record:
subset(AllstarFull, playerID == "aaronha01")
#> playerID yearID gameNum gameID teamID lgID GP startingPos
#> 26 aaronha01 1957 0 NLS195707090 MLN NL 1 9
#> 76 aaronha01 1958 0 ALS195807080 MLN NL 1 9
#> 167 aaronha01 1959 1 NLS195907070 MLN NL 1 9
#> 168 aaronha01 1959 2 NLS195908030 MLN NL 1 9
#> 285 aaronha01 1960 1 ALS196007110 MLN NL 1 9
#> 286 aaronha01 1960 2 ALS196007130 MLN NL 1 9
#> 401 aaronha01 1961 1 NLS196107110 MLN NL 1 NA
#> 402 aaronha01 1961 2 ALS196107310 MLN NL 1 NA
#> 528 aaronha01 1962 0 NLS196207300 MLN NL 1 NA
#> 591 aaronha01 1963 0 ALS196307090 MLN NL 1 9
#> 645 aaronha01 1964 0 NLS196407070 MLN NL 1 NA
#> 697 aaronha01 1965 0 ALS196507130 MLN NL 1 9
#> 746 aaronha01 1966 0 NLS196607120 ATL NL 1 7
#> 801 aaronha01 1967 0 ALS196707110 ATL NL 1 8
#> 1193 aaronha01 1968 0 NLS196807090 ATL NL 1 9
#> 1251 aaronha01 1969 0 ALS196907230 ATL NL 1 9
#> 1308 aaronha01 1970 0 NLS197007140 ATL NL 1 9
#> 1369 aaronha01 1971 0 ALS197107130 ATL NL 1 9
#> 1431 aaronha01 1972 0 NLS197207250 ATL NL 1 9
#> 1485 aaronha01 1973 0 ALS197307240 ATL NL 1 3
#> 1552 aaronha01 1974 0 NLS197407230 ATL NL 1 9
#> 1581 aaronha01 1975 0 ALS197507150 MIL AL 1 NA
#> 2130 aaronha01 1955 0 NLS195507120 MLN NL 1 NA
#> 3594 aaronha01 1956 0 ALS195607100 MLN NL 1 NA
# Years that Stan Musial played in the ASG:
with(AllstarFull, yearID[playerID == "musiast01"])
#> [1] 1957 1958 1959 1959 1960 1960 1961 1961 1962 1962 1963 1951 1952 1953 1954
#> [16] 1955 1943 1944 1946 1947 1948 1949 1950 1956
# Starting positions he played (NA means did not start)
with(AllstarFull, startingPos[playerID == "musiast01"])
#> [1] 3 3 3 NA NA NA NA NA NA NA NA 7 8 7 9 NA 7 8 7 NA 7 8 3 9
# All-Star rosters from the 1966 ASG
subset(AllstarFull, gameID == "NLS196607120")
#> playerID yearID gameNum gameID teamID lgID GP startingPos
#> 714 mclaide01 1966 0 NLS196607120 DET AL 1 1
#> 715 freehbi01 1966 0 NLS196607120 DET AL 1 2
#> 716 scottge02 1966 0 NLS196607120 BOS AL 1 3
#> 717 knoopbo01 1966 0 NLS196607120 CAL AL 1 4
#> 718 robinbr01 1966 0 NLS196607120 BAL AL 1 5
#> 719 mcauldi01 1966 0 NLS196607120 DET AL 1 6
#> 720 robinfr02 1966 0 NLS196607120 BAL AL 1 7
#> 721 kalinal01 1966 0 NLS196607120 DET AL 1 8
#> 722 olivato01 1966 0 NLS196607120 MIN AL 1 9
#> 723 ageeto01 1966 0 NLS196607120 CHA AL 1 NA
#> 724 barbest01 1966 0 NLS196607120 BAL AL 0 NA
#> 725 batteea01 1966 0 NLS196607120 MIN AL 1 NA
#> 726 bellga01 1966 0 NLS196607120 CLE AL 0 NA
#> 727 cashno01 1966 0 NLS196607120 DET AL 1 NA
#> 728 colavro01 1966 0 NLS196607120 CLE AL 1 NA
#> 729 etchean01 1966 0 NLS196607120 BAL AL 0 NA
#> 730 fregoji01 1966 0 NLS196607120 CAL AL 1 NA
#> 731 hunteca01 1966 0 NLS196607120 KC1 AL 0 NA
#> 732 kaatji01 1966 0 NLS196607120 MIN AL 1 NA
#> 733 killeha01 1966 0 NLS196607120 MIN AL 1 NA
#> 734 mcdowsa01 1966 0 NLS196607120 CLE AL 0 NA
#> 735 richabo01 1966 0 NLS196607120 NYA AL 1 NA
#> 736 richepe01 1966 0 NLS196607120 WS2 AL 1 NA
#> 737 siebeso01 1966 0 NLS196607120 CLE AL 1 NA
#> 738 stottme01 1966 0 NLS196607120 NYA AL 1 NA
#> 739 yastrca01 1966 0 NLS196607120 BOS AL 0 NA
#> 740 koufasa01 1966 0 NLS196607120 LAN NL 1 1
#> 741 torrejo01 1966 0 NLS196607120 ATL NL 1 2
#> 742 mccovwi01 1966 0 NLS196607120 SFN NL 1 3
#> 743 lefebji01 1966 0 NLS196607120 LAN NL 1 4
#> 744 santoro01 1966 0 NLS196607120 CHN NL 1 5
#> 745 cardele01 1966 0 NLS196607120 CIN NL 1 6
#> 746 aaronha01 1966 0 NLS196607120 ATL NL 1 7
#> 747 mayswi01 1966 0 NLS196607120 SFN NL 1 8
#> 748 clemero01 1966 0 NLS196607120 PIT NL 1 9
#> 749 allendi01 1966 0 NLS196607120 PHI NL 1 NA
#> 750 aloufe01 1966 0 NLS196607120 ATL NL 0 NA
#> 751 bunniji01 1966 0 NLS196607120 PHI NL 1 NA
#> 752 floodcu01 1966 0 NLS196607120 SLN NL 1 NA
#> 753 gibsobo01 1966 0 NLS196607120 SLN NL 0 NA
#> 754 halleto01 1966 0 NLS196607120 SFN NL 0 NA
#> 755 hartji01 1966 0 NLS196607120 SFN NL 1 NA
#> 756 huntro01 1966 0 NLS196607120 NYN NL 1 NA
#> 757 maricju01 1966 0 NLS196607120 SFN NL 1 NA
#> 758 mccarti01 1966 0 NLS196607120 SLN NL 1 NA
#> 759 mccoobi01 1966 0 NLS196607120 CIN NL 0 NA
#> 760 morgajo02 1966 0 NLS196607120 HOU NL 0 NA
#> 761 perryga01 1966 0 NLS196607120 SFN NL 1 NA
#> 762 raymocl01 1966 0 NLS196607120 HOU NL 0 NA
#> 763 reganph01 1966 0 NLS196607120 LAN NL 0 NA
#> 764 stargwi01 1966 0 NLS196607120 PIT NL 1 NA
#> 765 vealebo01 1966 0 NLS196607120 PIT NL 0 NA
#> 766 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
#> 4311 cordech01 2005 0 ALS200507120 WAS NL 1 NA
#> 4315 hernali01 2005 0 ALS200507120 WAS NL 1 NA
#> 4373 soriaal01 2006 0 NLS200607110 WAS NL 1 7
#> 4467 youngdm01 2007 0 NLS200707100 WAS NL 1 NA
#> 4514 guzmacr01 2008 0 ALS200807150 WAS NL 1 NA
#> 4605 zimmery01 2009 0 NLS200907140 WAS NL 1 NA
#> 4662 cappsma01 2010 0 ALS201007130 WAS NL 1 NA
#> 4744 clippty01 2011 0 NLS201107120 WAS NL 1 NA
#> 4822 desmoia01 2012 0 ALS201207100 WAS NL 0 NA
#> 4825 gonzagi01 2012 0 ALS201207100 WAS NL 1 NA
#> 4828 harpebr03 2012 0 ALS201207100 WAS NL 1 NA
#> 4842 strasst01 2012 0 ALS201207100 WAS NL 1 NA
#> 4892 harpebr03 2013 0 NLS201307160 WAS NL 1 8
#> 4921 zimmejo02 2013 0 NLS201307160 WAS NL 0 NA
#> 4978 clippty01 2014 0 ALS201407150 WAS NL 1 NA
#> 5002 zimmejo02 2014 0 ALS201407150 WAS NL 0 NA
#> 5049 harpebr03 2015 0 NLS201507140 WAS NL 1 9
#> 5074 scherma01 2015 0 NLS201507140 WAS NL 0 NA
#> 5125 harpebr03 2016 0 ALS201607120 WAS NL 1 9
#> 5148 murphda08 2016 0 ALS201607120 WAS NL 1 NA
#> 5151 ramoswi01 2016 0 ALS201607120 WAS NL 1 NA
#> 5153 scherma01 2016 0 ALS201607120 WAS NL 1 NA
#> 5155 strasst01 2016 0 ALS201607120 WAS NL 0 NA
#> 5196 scherma01 2017 0 NLS201707110 WAS NL 1 1
#> 5198 zimmery01 2017 0 NLS201707110 WAS NL 1 3
#> 5199 murphda08 2017 0 NLS201707110 WAS NL 1 4
#> 5204 harpebr03 2017 0 NLS201707110 WAS NL 1 9
#> 5225 strasst01 2017 0 NLS201707110 WAS NL 0 NA
#> 5266 scherma01 2018 0 NLS201807170 WAS NL 1 1
#> 5273 harpebr03 2018 0 NLS201807170 WAS NL 1 8
#> 5282 doolise01 2018 0 NLS201807170 WAS NL 0 NA
#> 5365 rendoan01 2019 0 ALS201907090 WAS NL 0 NA
#> 5367 scherma01 2019 0 ALS201907090 WAS NL 0 NA
#> 5414 scherma01 2021 0 NLS202107130 WAS NL 1 1
#> 5447 schwaky01 2021 0 NLS202107130 WAS NL 0 NA
#> 5448 sotoju01 2021 0 NLS202107130 WAS NL 1 NA
#> 5451 turnetr01 2021 0 NLS202107130 WAS NL 1 NA
#> 5514 sotoju01 2022 0 NLS202207190 WAS NL 1 NA
#> 5545 grayjo03 2023 0 ALS202307110 WAS NL 1 NA
#> 5658 sotoju01 2022 0 NLS202207190 WAS NL 1 NA
# Teams with the fewest All-Stars
rare <- names(which(table(AllstarFull$teamID) < 10))
# Records associated with the 'rare' teams:
# (There are a few teamID typos: can you spot them?)
subset(AllstarFull, teamID %in% rare)
#> playerID yearID gameNum gameID teamID lgID GP startingPos
#> 1225 heganmi01 1969 0 ALS196907230 SE1 AL 0 NA
#> 1234 minchdo01 1969 0 ALS196907230 SE1 AL 1 NA