ManagersHalf table
ManagersHalf.Rd
Split season data for managers
Usage
data(ManagersHalf)
Format
A data frame with 93 observations on the following 10 variables.
playerID
Manager (player) ID code
yearID
Year
teamID
Team; a factor
lgID
League; a factor with levels
AL
NL
inseason
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
1
2
3
4
5
half
First or second half of season
G
Games managed
W
Wins
L
Losses
rank
Team's position in standings for the half
Source
Lahman, S. (2024) Lahman's Baseball Database, 1871-2023, 2024 version, http://www.seanlahman.com/
Examples
library("dplyr")
library("reshape2")
#>
#> Attaching package: 'reshape2'
#> The following object is masked from 'package:tidyr':
#>
#> smiths
# 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`)
#> playerID yearID teamID lgID rank1 rank2
#> 1 amalfjo01 1981 CHN NL 6 5
#> 2 andersp01 1981 DET AL 4 2
#> 3 coxbo01 1981 ATL NL 4 5
#> 4 garcida99 1981 CLE AL 6 5
#> 5 greenda02 1981 PHI NL 1 3
#> 6 herzowh01 1981 SLN NL 2 2
#> 7 houkra01 1981 BOS AL 5 2
#> 8 howarfr01 1981 SDN NL 6 6
#> 9 larusto01 1981 CHA AL 3 6
#> 10 lasorto01 1981 LAN NL 1 4
#> 11 martibi02 1981 OAK AL 1 2
#> 12 mattibo01 1981 TOR AL 7 7
#> 13 mcnamjo99 1981 CIN NL 2 2
#> 14 robinfr02 1981 SFN NL 5 3
#> 15 rodgebu01 1981 ML4 AL 3 1
#> 16 tannech01 1981 PIT NL 4 6
#> 17 torrejo01 1981 NYN NL 5 4
#> 18 virdobi01 1981 HOU NL 3 1
#> 19 weaveea99 1981 BAL AL 2 4
#> 20 zimmedo01 1981 TEX AL 2 3