All Star appearances by players
A data frame with 5454 observations on the following 8 variables.
Player ID code
Game number (for years in which more than one game was played)
Game ID code
Team; a factor
League; a factor with levels
Game played (zero if player did not appear in game)
If the player started, what position he played
Lahman, S. (2022) Lahman's Baseball Database, 1871-2021, 2021 version, https://www.seanlahman.com/baseball-archive/statistics/
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.