| TeamsHalf | R Documentation |
Split season data for teams
data(TeamsHalf)
A data frame with 52 observations on the following 10 variables.
yearIDYear
lgIDLeague; a factor with levels AL NL
teamIDTeam; a factor
HalfFirst or second half of season
divIDDivision
DivWinWon Division (Y or N)
RankTeam's position in standings for the half
GGames played
WWins
LLosses
Lahman, S. (2024) Lahman's Baseball Database, 1871-2023, 2024 version, http://www.seanlahman.com/
# 1981 season team data split into half seasons
data(TeamsHalf)
library("dplyr")
# List standings with winning percentages by
# season half, league and division
TeamsHalf %>%
group_by(Half, lgID, divID) %>%
mutate(WinPct = round(W/G, 3)) %>%
arrange(Half, lgID, divID, Rank) %>%
select(Half, lgID, divID, Rank, teamID, WinPct)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.