Description Usage Format Source Examples
All Star appearances by players
1 |
A data frame with 4912 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
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 37 38 | 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)
# 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]
hist(player_appearances[player_appearances > 10])
# Hank Aaron's All-Star record:
subset(AllstarFull, playerID == "aaronha01")
# Years that Stan Musial played in the ASG:
with(AllstarFull, yearID[playerID == "musiast01"])
# Starting positions he played (NA means did not start)
with(AllstarFull, startingPos[playerID == "musiast01"])
# All-Star rosters from the 1966 ASG
subset(AllstarFull, gameID == "NLS196607120")
# All-Stars from the Washington Nationals
subset(AllstarFull, teamID == "WAS")
# 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)
|
[1] 1774
playerID
aaronha01 musiast01 mayswi01 mantlmi01 willite01 ripkeca01 yastrca01 robinbr01
25 24 24 20 19 19 18 18
kalinal01 carewro01 berrayo01 spahnwa01 rosepe01 smithoz01 gwynnto01 foxne01
18 18 18 17 17 15 15 15
clemero01 rodriiv01 rodrial01 robinfr02 jeterde01 jacksre01 bondsba01 benchjo01
15 14 14 14 14 14 14 14
bankser01 riverma01 killeha01 griffke02 dimagjo01 brettge01 aparilu01 winfida01
14 13 13 13 13 13 13 12
seaveto01 schmimi01 ramirma02 piazzmi01 ottme01 mcgwima01 matheed01 larkiba01
12 12 12 12 12 12 12 12
howarel01 boggswa01 alomaro01 freehbi01 fiskca01 dickebi01 crandde01 clemero02
12 12 12 11 11 11 11 11
cepedor01 cartega01 cabremi01 boyerke01
11 11 11 11
playerID yearID gameNum gameID teamID lgID GP startingPos
1127 aaronha01 1955 0 NLS195507120 ML1 NL 1 NA
1179 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
1604 aaronha01 1961 1 NLS196107110 ML1 NL 1 NA
1605 aaronha01 1961 2 ALS196107310 ML1 NL 1 NA
1714 aaronha01 1962 1 ALS196207100 ML1 NL 0 NA
1715 aaronha01 1962 2 NLS196207300 ML1 NL 1 NA
1785 aaronha01 1963 0 ALS196307090 ML1 NL 1 9
1839 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
2436 aaronha01 1975 0 ALS197507150 ML4 AL 1 NA
[1] 1943 1944 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958
[16] 1959 1959 1960 1960 1961 1961 1962 1962 1963
[1] 7 8 7 NA 7 8 3 7 8 7 9 NA 9 3 3 3 NA NA NA NA NA NA NA NA
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 ageeto01 1966 0 NLS196607120 CHA AL 1 NA
1918 barbest01 1966 0 NLS196607120 BAL AL 0 NA
1919 batteea01 1966 0 NLS196607120 MIN AL 1 NA
1920 bellga01 1966 0 NLS196607120 CLE AL 0 NA
1921 cashno01 1966 0 NLS196607120 DET AL 1 NA
1922 colavro01 1966 0 NLS196607120 CLE AL 1 NA
1923 etchean01 1966 0 NLS196607120 BAL AL 0 NA
1924 fregoji01 1966 0 NLS196607120 CAL AL 1 NA
1925 hunteca01 1966 0 NLS196607120 KC1 AL 0 NA
1926 kaatji01 1966 0 NLS196607120 MIN AL 1 NA
1927 killeha01 1966 0 NLS196607120 MIN AL 1 NA
1928 mcdowsa01 1966 0 NLS196607120 CLE AL 0 NA
1929 richabo01 1966 0 NLS196607120 NYA AL 1 NA
1930 richepe01 1966 0 NLS196607120 WS2 AL 1 NA
1931 siebeso01 1966 0 NLS196607120 CLE AL 1 NA
1932 stottme01 1966 0 NLS196607120 NYA AL 1 NA
1933 yastrca01 1966 0 NLS196607120 BOS AL 0 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 allendi01 1966 0 NLS196607120 PHI NL 1 NA
1944 aloufe01 1966 0 NLS196607120 ATL NL 0 NA
1945 bunniji01 1966 0 NLS196607120 PHI NL 1 NA
1946 floodcu01 1966 0 NLS196607120 SLN NL 1 NA
1947 gibsobo01 1966 0 NLS196607120 SLN NL 0 NA
1948 halleto01 1966 0 NLS196607120 SFN NL 0 NA
1949 hartji01 1966 0 NLS196607120 SFN NL 1 NA
1950 huntro01 1966 0 NLS196607120 NYN NL 1 NA
1951 maricju01 1966 0 NLS196607120 SFN NL 1 NA
1952 mccarti01 1966 0 NLS196607120 SLN NL 1 NA
1953 mccoobi01 1966 0 NLS196607120 CIN NL 0 NA
1954 morgajo02 1966 0 NLS196607120 HOU NL 0 NA
1955 perryga01 1966 0 NLS196607120 SFN NL 1 NA
1956 raymocl01 1966 0 NLS196607120 HOU NL 0 NA
1957 reganph01 1966 0 NLS196607120 LAN NL 0 NA
1958 stargwi01 1966 0 NLS196607120 PIT NL 1 NA
1959 vealebo01 1966 0 NLS196607120 PIT NL 0 NA
1960 willsma01 1966 0 NLS196607120 LAN NL 1 NA
playerID yearID gameNum gameID teamID lgID GP startingPos
4299 cordech01 2005 0 ALS200507120 WAS NL 1 NA
4303 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
4502 guzmacr01 2008 0 ALS200807150 WAS NL 1 NA
4594 zimmery01 2009 0 NLS200907140 WAS NL 1 NA
4651 cappsma01 2010 0 ALS201007130 WAS NL 1 NA
4735 clippty01 2011 0 NLS201107120 WAS NL 1 NA
4812 desmoia01 2012 0 ALS201207100 WAS NL 0 NA
4815 gonzagi01 2012 0 ALS201207100 WAS NL 1 NA
4818 harpebr03 2012 0 ALS201207100 WAS NL 1 NA
4832 strasst01 2012 0 ALS201207100 WAS NL 1 NA
4883 harpebr03 2013 0 NLS201307160 WAS NL 1 8
4912 zimmejo02 2013 0 NLS201307160 WAS NL 0 NA
4969 clippty01 2014 0 ALS201407150 WAS NL 1 NA
4993 zimmejo02 2014 0 ALS201407150 WAS NL 0 NA
5041 harpebr03 2015 0 NLS201507140 WAS NL 1 9
5061 scherma01 2015 0 NLS201507151 WAS NL NA NA
5125 harpebr03 2016 0 ALS201607120 WAS NL 1 9
5133 murphda08 2016 0 ALS201607120 WAS NL 1 NA
5139 ramoswi01 2016 0 ALS201607120 WAS NL 1 NA
5143 scherma01 2016 0 ALS201607120 WAS NL 1 NA
5145 strasst01 2016 0 ALS201607120 WAS NL 0 NA
playerID yearID gameNum gameID teamID lgID GP startingPos
2080 heganmi01 1969 0 ALS196907230 SE1 AL 0 NA
2089 minchdo01 1969 0 ALS196907230 SE1 AL 1 NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.