Last data update: 2014.03.03

R: Master table
MasterR Documentation

Master table

Description

Master table - Player names, DOB, and biographical info. This file is to be used to get details about players listed in the Batting, Pitching, and other files where players are identified only by playerID.

Usage

data(Master)

Format

A data frame with 18589 observations on the following 26 variables.

playerID

A unique code asssigned to each player. The playerID links the data in this file with records on players in the other files.

birthYear

Year player was born

birthMonth

Month player was born

birthDay

Day player was born

birthCountry

Country where player was born

birthState

State where player was born

birthCity

City where player was born

deathYear

Year player died

deathMonth

Month player died

deathDay

Day player died

deathCountry

Country where player died

deathState

State where player died

deathCity

City where player died

nameFirst

Player's first name

nameLast

Player's last name

nameGiven

Player's given name (typically first and middle)

weight

Player's weight in pounds

height

Player's height in inches

bats

a factor: Player's batting hand (left (L), right (R), or both (B))

throws

a factor: Player's throwing hand (left(L) or right(R))

debut

Date that player made first major league appearance

finalGame

Date that player made first major league appearance (blank if still active)

retroID

ID used by retrosheet, http://www.retrosheet.org/

bbrefID

ID used by Baseball Reference website, http://www.baseball-reference.com/

birthDate

Player's birthdate, in as.Date format

deathDate

Player's deathdate, in as.Date format

Details

debut, finalGame were converted from character strings with as.Date.

Source

Lahman, S. (2015) Lahman's Baseball Database, 1871-2014, 2015 version, http://baseball1.com/statistics/

Examples

data(Master); data(Batting)

## add player's name to Batting data
Master$name <- paste(Master$nameFirst, Master$nameLast, sep=' ')
batting <- merge(Batting, 
                 Master[,c("playerID","name")], 
                 by="playerID", all.x=TRUE)

## batting and throwing
# right-handed batters are much less ambidexterous in throwing than left-handed batters
# (should only include batters)

BT <- with(Master, table(bats, throws))
require(vcd)
structable(BT)
mosaic(BT, shade=TRUE)

## Who is Shoeless Joe Jackson?
subset(Master, nameLast=="Jackson" & nameFirst=="Joe")
subset(Master, nameLast=="Jackson" & nameFirst=="Shoeless Joe")

joeID <-c(subset(Master, nameLast=="Jackson" & nameFirst=="Shoeless Joe")["playerID"])

subset(Batting, playerID==joeID)
subset(Fielding, playerID==joeID)


Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Lahman)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Lahman/Master.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Master
> ### Title: Master table
> ### Aliases: Master
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data(Master); data(Batting)
> 
> ## add player's name to Batting data
> Master$name <- paste(Master$nameFirst, Master$nameLast, sep=' ')
> batting <- merge(Batting, 
+                  Master[,c("playerID","name")], 
+                  by="playerID", all.x=TRUE)
> 
> ## batting and throwing
> # right-handed batters are much less ambidexterous in throwing than left-handed batters
> # (should only include batters)
> 
> BT <- with(Master, table(bats, throws))
> require(vcd)
Loading required package: vcd
Loading required package: grid
> structable(BT)
     throws     L     R
bats                   
B             182   956
L            2742  2031
R             550 10814
> mosaic(BT, shade=TRUE)
> 
> ## Who is Shoeless Joe Jackson?
> subset(Master, nameLast=="Jackson" & nameFirst=="Joe")
 [1] playerID     birthYear    birthMonth   birthDay     birthCountry
 [6] birthState   birthCity    deathYear    deathMonth   deathDay    
[11] deathCountry deathState   deathCity    nameFirst    nameLast    
[16] nameGiven    weight       height       bats         throws      
[21] debut        finalGame    retroID      bbrefID      deathDate   
[26] birthDate    name        
<0 rows> (or 0-length row.names)
> subset(Master, nameLast=="Jackson" & nameFirst=="Shoeless Joe")
      playerID birthYear birthMonth birthDay birthCountry birthState
8099 jacksjo01      1887          7       16          USA         SC
          birthCity deathYear deathMonth deathDay deathCountry deathState
8099 Pickens County      1951         12        5          USA         SC
      deathCity    nameFirst nameLast        nameGiven weight height bats
8099 Greenville Shoeless Joe  Jackson Joseph Jefferson    200     73    L
     throws     debut finalGame  retroID   bbrefID  deathDate  birthDate
8099      R 8/25/1908 9/27/1920 jackj101 jacksjo01 1951-12-05 1887-07-16
                     name
8099 Shoeless Joe Jackson
> 
> joeID <-c(subset(Master, nameLast=="Jackson" & nameFirst=="Shoeless Joe")["playerID"])
> 
> subset(Batting, playerID==joeID)
       playerID yearID stint teamID lgID   G  AB   R   H X2B X3B HR RBI SB CS
11260 jacksjo01   1908     1    PHA   AL   5  23   0   3   0   0  0   3  0 NA
11772 jacksjo01   1909     1    PHA   AL   5  17   3   3   0   0  0   3  0 NA
12317 jacksjo01   1910     1    CLE   AL  20  75  15  29   2   5  1  11  4 NA
12866 jacksjo01   1911     1    CLE   AL 147 571 126 233  45  19  7  83 41 NA
13453 jacksjo01   1912     1    CLE   AL 154 572 121 226  44  26  3  90 35 NA
14088 jacksjo01   1913     1    CLE   AL 148 528 109 197  39  17  7  71 26 NA
14778 jacksjo01   1914     1    CLE   AL 122 453  61 153  22  13  3  53 22 15
15565 jacksjo01   1915     1    CLE   AL  83 303  42  99  16   9  3  45 10 10
15566 jacksjo01   1915     2    CHA   AL  45 158  21  43   4   5  2  36  6 10
16257 jacksjo01   1916     1    CHA   AL 155 592  91 202  40  21  3  78 24 14
16783 jacksjo01   1917     1    CHA   AL 146 538  91 162  20  17  5  75 13 NA
17314 jacksjo01   1918     1    CHA   AL  17  65   9  23   2   2  1  20  3 NA
17801 jacksjo01   1919     1    CHA   AL 139 516  79 181  31  14  7  96  9 NA
18342 jacksjo01   1920     1    CHA   AL 146 570 105 218  42  20 12 121  9 12
      BB SO IBB HBP SH SF GIDP
11260  0 NA  NA   0  0 NA   NA
11772  1 NA  NA   0  0 NA   NA
12317  8 NA  NA   0  3 NA   NA
12866 56 NA  NA   8  6 NA   NA
13453 54 NA  NA  12 15 NA   NA
14088 80 26  NA   5 10 NA   NA
14778 41 34  NA   5 13 NA   NA
15565 28 11  NA   3  3 NA   NA
15566 24 12  NA   3  8 NA   NA
16257 46 25  NA   5 16 NA   NA
16783 57 25  NA   7 19 NA   NA
17314  8  1  NA   0  5 NA   NA
17801 60 10  NA   4 17 NA   NA
18342 56 14  NA   7 16 NA   NA
> subset(Fielding, playerID==joeID)
       playerID yearID stint teamID lgID POS   G GS InnOuts  PO  A  E DP PB WP
19768 jacksjo01   1908     1    PHA   AL  OF   5 NA      NA   6  1  1  0 NA NA
20437 jacksjo01   1909     1    PHA   AL  OF   4 NA      NA  10  0  2  0 NA NA
21155 jacksjo01   1910     1    CLE   AL  OF  20 NA      NA  40  2  1  1 NA NA
21891 jacksjo01   1911     1    CLE   AL  OF 147 NA      NA 242 32 12  8 NA NA
22635 jacksjo01   1912     1    CLE   AL  OF 150 NA      NA 273 30 16  2 NA NA
23413 jacksjo01   1913     1    CLE   AL  OF 148 NA      NA 211 28 18  5 NA NA
24307 jacksjo01   1914     1    CLE   AL  OF 119 NA      NA 195 13  7  4 NA NA
25361 jacksjo01   1915     1    CLE   AL  1B  30 NA      NA 284 15  7 12 NA NA
25362 jacksjo01   1915     1    CLE   AL  OF  50 NA      NA  68  6  3  0 NA NA
25363 jacksjo01   1915     2    CHA   AL  OF  45 NA      NA  84  6  5  1 NA NA
26271 jacksjo01   1916     1    CHA   AL  OF 155 NA      NA 290 17  8  5 NA NA
26953 jacksjo01   1917     1    CHA   AL  OF 145 NA      NA 341 18  6  4 NA NA
27659 jacksjo01   1918     1    CHA   AL  OF  17 NA      NA  36  1  0  0 NA NA
28313 jacksjo01   1919     1    CHA   AL  OF 139 NA      NA 252 15  9  4 NA NA
28989 jacksjo01   1920     1    CHA   AL  OF 145 NA      NA 314 14 12  2 NA NA
      SB CS ZR
19768 NA NA NA
20437 NA NA NA
21155 NA NA NA
21891 NA NA NA
22635 NA NA NA
23413 NA NA NA
24307 NA NA NA
25361 NA NA NA
25362 NA NA NA
25363 NA NA NA
26271 NA NA NA
26953 NA NA NA
27659 NA NA NA
28313 NA NA NA
28989 NA NA NA
> 
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>