| AllstarFull | R Documentation |
AllstarFull table
Description
All Star appearances by players
Usage
data(AllstarFull)
Format
A data frame with 5655 observations on the following 8 variables.
playerIDPlayer ID code
yearIDYear
gameNumGame number (for years in which more than one game was played)
gameIDGame ID code
teamIDTeam; a factor
lgIDLeague; a factor with levels
ALNLGPGame played (zero if player did not appear in game)
startingPosIf the player started, what position he played
Source
Lahman, S. (2025) Lahman's Baseball Database, 1871-2024, 2025 version, https://sabr.org/lahman-database/
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)
# 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 a few teamID typos: can you spot them?)
subset(AllstarFull, teamID %in% rare)