Split season data for managers
A data frame with 93 observations on the following 10 variables.
Manager (player) ID code
Team; a factor
League; a factor with levels
Managerial 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
First or second half of season
Team's position in standings for the half
Lahman, S. (2022) Lahman's Baseball Database, 1871-2021, 2021 version, https://www.seanlahman.com/baseball-archive/statistics/
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)) %>% # 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`)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.