| ManagersHalf {Lahman} | R Documentation |
ManagersHalf table
Description
Split season data for managers
Usage
data(ManagersHalf)
Format
A data frame with 93 observations on the following 10 variables.
playerIDManager (player) ID code
yearIDYear
teamIDTeam; a factor
lgIDLeague; a factor with levels
ALNLinseasonManagerial order. One if the individual managed the team the entire year. Otherwise denotes where the manager appeared in the managerial order (1 for first manager, 2 for second, etc.). A factor with levels
12345halfFirst or second half of season
GGames managed
WWins
LLosses
rankTeam's position in standings for the half
Source
Lahman, S. (2023) Lahman's Baseball Database, 1871-2022, 2022 version, https://www.seanlahman.com/baseball-archive/statistics/
Examples
library("dplyr")
library("reshape2")
# Only have data for 1892 and 1981
# League rank by half for 1981 teams with the same
# manager in both halves who were hired in-season
ManagersHalf %>%
filter(yearID >= 1901) %>%
group_by(teamID, yearID) %>%
filter(all(playerID == playerID[1])) %>% # same manager in both halves
mutate(winPct = round(W/G, 3)) %>%
reshape2::dcast(playerID + yearID + teamID + lgID ~ half,
value.var = "rank") %>%
rename(rank1 = `1`, rank2 = `2`)
[Package Lahman version 11.0-0 Index]