This Project will look at the Lahman database on MLB statistics and from the

Wikipedia list of players who used Performance enhancing Drugs and compare the

stats for them before announcement and post announcement of use of PED’s.

While many will think that the performance of Athelics will increase by taking

PED’s, it will be interesting to see if that is the case or not.

Get the data (wikipedia site)

bb_player_PED <- read.csv("Baseball_Players_PED.csv")
head(bb_player_PED, 10)
##                   Player                 Team    Date.announced       Drug
## 1           Alex Sánchez Tampa Bay Devil Rays     April 3, 2005           
## 2        Agustín Montero        Texas Rangers    April 20, 2005           
## 3           Jamal Strong     Seattle Mariners    April 26, 2005           
## 4            Juan Rincón      Minnesota Twins       May 2, 2005           
## 5      Rafael Betancourt    Cleveland Indians      July 8, 2005           
## 6  Rafael Palmeiro SS GG    Baltimore Orioles    August 1, 2005 Stanozolol
## 7          Ryan Franklin     Seattle Mariners    August 2, 2005           
## 8             Mike Morse     Seattle Mariners September 7, 2005           
## 9        Carlos Almanzar        Texas Rangers   October 4, 2005           
## 10         Félix Heredia        New York Mets  October 18, 2005           
##    Penalty Position Response Ref.
## 1  10 days       OF      [a]  [5]
## 2  10 days        P      [b]  [7]
## 3  10 days       OF      [c]  [9]
## 4  10 days        P      [d]  [9]
## 5  10 days        P      [e] [12]
## 6  10 days       DH      [f] [14]
## 7  10 days        P      [g] [16]
## 8  10 days       SS      [h] [18]
## 9  10 days        P      [i] [20]
## 10 10 days        P      [j] [22]

Go into the Lahman Databse

(you have three options, donwload it as a csv, MS Access or SQL) for the

challenge I decided to go with SQL instead of being used to csv files

There are archive data that contains previous MLB season but the one I will

use is 2015 MLB (at the time of this project the latest is 2015 as that is

the most recent one)

# connect to database
con <- dbConnect(MySQL(), user = "cunysps", password = "cunyspsdb",
                 dbname = "stats", host = "127.0.0.1")

# Query to get baseball battings statistics during regular season since 1990
bb_batting_query <- "select b.*, m.nameFirst, m.nameLast, m.nameGiven, m.bats, m.throws, m.debut, m.finalGame
from batting b inner join stats.master m
on b.playerID = m.playerID
where b.yearID >= 1990;"

baseball_batting_data <- dbGetQuery(con, bb_batting_query)
summary(baseball_batting_data)
##    playerID             yearID         stint          teamID         
##  Length:31875       Min.   :1990   Min.   :1.000   Length:31875      
##  Class :character   1st Qu.:1998   1st Qu.:1.000   Class :character  
##  Mode  :character   Median :2004   Median :1.000   Mode  :character  
##                     Mean   :2004   Mean   :1.083                     
##                     3rd Qu.:2010   3rd Qu.:1.000                     
##                     Max.   :2015   Max.   :4.000                     
##      lgID                 G                AB              R         
##  Length:31875       Min.   :  0.00   Min.   :  0.0   Min.   :  0.00  
##  Class :character   1st Qu.: 15.00   1st Qu.:  1.0   1st Qu.:  0.00  
##  Mode  :character   Median : 35.00   Median : 29.0   Median :  2.00  
##                     Mean   : 52.35   Mean   :129.9   Mean   : 17.47  
##                     3rd Qu.: 78.00   3rd Qu.:205.0   3rd Qu.: 25.00  
##                     Max.   :163.00   Max.   :716.0   Max.   :152.00  
##        H                2B               3B                HR        
##  Min.   :  0.00   Min.   : 0.000   Min.   : 0.0000   Min.   : 0.000  
##  1st Qu.:  0.00   1st Qu.: 0.000   1st Qu.: 0.0000   1st Qu.: 0.000  
##  Median :  5.00   Median : 1.000   Median : 0.0000   Median : 0.000  
##  Mean   : 34.09   Mean   : 6.652   Mean   : 0.7258   Mean   : 3.807  
##  3rd Qu.: 51.00   3rd Qu.:10.000   3rd Qu.: 1.0000   3rd Qu.: 4.000  
##  Max.   :262.00   Max.   :59.000   Max.   :23.0000   Max.   :73.000  
##       RBI               SB               CS               BB        
##  Min.   :  0.00   Min.   : 0.000   Min.   : 0.000   Min.   :  0.00  
##  1st Qu.:  0.00   1st Qu.: 0.000   1st Qu.: 0.000   1st Qu.:  0.00  
##  Median :  2.00   Median : 0.000   Median : 0.000   Median :  1.00  
##  Mean   : 16.58   Mean   : 2.408   Mean   : 1.028   Mean   : 12.51  
##  3rd Qu.: 23.00   3rd Qu.: 1.000   3rd Qu.: 1.000   3rd Qu.: 17.00  
##  Max.   :165.00   Max.   :78.000   Max.   :28.000   Max.   :232.00  
##        SO             IBB                HBP                 SH           
##  Min.   :  0.00   Length:31875       Length:31875       Length:31875      
##  1st Qu.:  0.00   Class :character   Class :character   Class :character  
##  Median :  8.00   Mode  :character   Mode  :character   Mode  :character  
##  Mean   : 25.13                                                           
##  3rd Qu.: 38.00                                                           
##  Max.   :223.00                                                           
##       SF                GIDP            nameFirst        
##  Length:31875       Length:31875       Length:31875      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
##                                                          
##    nameLast          nameGiven             bats          
##  Length:31875       Length:31875       Length:31875      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
##                                                          
##     throws             debut            finalGame        
##  Length:31875       Length:31875       Length:31875      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
## 
# Query to get baseball pitching statistics during regular season since 1990
bb_pitching_query <- "select p.*, m.nameFirst, m.nameLast, m.nameGiven, m.bats, m.throws, m.debut, m.finalGame
from pitching p inner join stats.master m
on p.playerID = m.playerID
where p.yearID >= 1990;"

baseball_pitching_data <- dbGetQuery(con, bb_pitching_query)
summary(baseball_pitching_data)
##    playerID             yearID         stint          teamID         
##  Length:16832       Min.   :1990   Min.   :1.000   Length:16832      
##  Class :character   1st Qu.:1997   1st Qu.:1.000   Class :character  
##  Mode  :character   Median :2004   Median :1.000   Mode  :character  
##                     Mean   :2003   Mean   :1.085                     
##                     3rd Qu.:2010   3rd Qu.:1.000                     
##                     Max.   :2015   Max.   :4.000                     
##      lgID                 W                L                G        
##  Length:16832       Min.   : 0.000   Min.   : 0.000   Min.   : 1.00  
##  Class :character   1st Qu.: 0.000   1st Qu.: 1.000   1st Qu.: 9.00  
##  Mode  :character   Median : 2.000   Median : 2.000   Median :22.00  
##                     Mean   : 3.591   Mean   : 3.591   Mean   :26.27  
##                     3rd Qu.: 5.000   3rd Qu.: 6.000   3rd Qu.:35.00  
##                     Max.   :27.000   Max.   :21.000   Max.   :94.00  
##        GS               CG               SHO               SV        
##  Min.   : 0.000   Min.   : 0.0000   Min.   :0.0000   Min.   : 0.000  
##  1st Qu.: 0.000   1st Qu.: 0.0000   1st Qu.:0.0000   1st Qu.: 0.000  
##  Median : 0.000   Median : 0.0000   Median :0.0000   Median : 0.000  
##  Mean   : 7.184   Mean   : 0.3422   Mean   :0.1202   Mean   : 1.822  
##  3rd Qu.:11.000   3rd Qu.: 0.0000   3rd Qu.:0.0000   3rd Qu.: 0.000  
##  Max.   :37.000   Max.   :15.0000   Max.   :6.0000   Max.   :62.000  
##      IPouts            H                ER               HR        
##  Min.   :  1.0   Min.   :  0.00   Min.   :  0.00   Min.   : 0.000  
##  1st Qu.: 47.0   1st Qu.: 17.00   1st Qu.:  9.00   1st Qu.: 2.000  
##  Median :136.0   Median : 44.00   Median : 20.00   Median : 5.000  
##  Mean   :192.5   Mean   : 64.55   Mean   : 30.35   Mean   : 7.209  
##  3rd Qu.:254.0   3rd Qu.: 87.00   3rd Qu.: 42.00   3rd Qu.:10.000  
##  Max.   :815.0   Max.   :284.00   Max.   :145.00   Max.   :48.000  
##        BB               SO            BAOpp                ERA         
##  Min.   :  0.00   Min.   :  0.00   Length:16832       Min.   :  0.000  
##  1st Qu.:  7.00   1st Qu.: 11.00   Class :character   1st Qu.:  3.380  
##  Median : 18.00   Median : 33.00   Mode  :character   Median :  4.450  
##  Mean   : 23.69   Mean   : 47.59                      Mean   :  5.423  
##  3rd Qu.: 33.00   3rd Qu.: 67.00                      3rd Qu.:  5.910  
##  Max.   :152.00   Max.   :372.00                      Max.   :189.000  
##      IBB                 WP                HBP                  BK        
##  Length:16832       Length:16832       Length:16832       Min.   :0.0000  
##  Class :character   Class :character   Class :character   1st Qu.:0.0000  
##  Mode  :character   Mode  :character   Mode  :character   Median :0.0000  
##                                                           Mean   :0.2746  
##                                                           3rd Qu.:0.0000  
##                                                           Max.   :9.0000  
##      BFP                 GF                  R               SH           
##  Length:16832       Length:16832       Min.   :  0.00   Length:16832      
##  Class :character   Class :character   1st Qu.: 10.00   Class :character  
##  Mode  :character   Mode  :character   Median : 22.00   Mode  :character  
##                                        Mean   : 33.09                     
##                                        3rd Qu.: 46.00                     
##                                        Max.   :160.00                     
##       SF                GIDP            nameFirst        
##  Length:16832       Length:16832       Length:16832      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
##                                                          
##    nameLast          nameGiven             bats          
##  Length:16832       Length:16832       Length:16832      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
##                                                          
##     throws             debut            finalGame        
##  Length:16832       Length:16832       Length:16832      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
## 
# get teamID and team names throughout since 1990
bb_teams_query <- "select distinct t.yearID, t.name, t.teamID, t.lgID
from stats.teams t where t.yearID >= 1990;"

baseball_teams_data <- dbGetQuery(con, bb_teams_query)
summary(baseball_teams_data)
##      yearID         name              teamID              lgID          
##  Min.   :1990   Length:758         Length:758         Length:758        
##  1st Qu.:1996   Class :character   Class :character   Class :character  
##  Median :2003   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :2003                                                           
##  3rd Qu.:2009                                                           
##  Max.   :2015
dbDisconnect(conn = con)
## [1] TRUE

Begin Cleaning the dataset(s)

# remove some columns from the baseball_players_PED list
# remove response and reference columns
bb_player_PED_clean <- bb_player_PED %>% select(-Ref.) %>% select(-Response)

# change the "Date.Announced" name to something more meaningful like "Date_Caught"
colnames(bb_player_PED_clean)[3] <- "Date_Caught"

# change the data type of Date_Caught to be of character format
bb_player_PED_clean$Date_Caught <- as.character(bb_player_PED_clean$Date_Caught)
# in the Penalty field, remove any '^' characters, [A] or [B] or [C] string
bb_player_PED_clean$Penalty <- gsub("(\\[A\\]|\\^|\\[B\\]|\\[C\\])", ""
                              ,bb_player_PED_clean$Penalty)

# in the Player's Name field, remove any "([0-9])" characters 
# and ("SS, GG, MVP") as it is not relvalent for this data analysis if a player
# was a Golden Glove or voted most valuable player.
bb_player_PED_clean$Player <- gsub("(SS|GG|MVP)", ""
                                   ,bb_player_PED_clean$Player)

bb_player_PED_clean$Player <- gsub("(\\([0-9]\\))", ""
                                   ,bb_player_PED_clean$Player)

# Trim white spaces
bb_player_PED_clean$Player <- str_trim(bb_player_PED_clean$Player)

# Remove accents in baseball player names (this will help us in cross-ref names
# with the lahman database)
bb_player_PED_clean$Player <- iconv(bb_player_PED_clean$Player,
                                    to = 'ASCII//TRANSLIT')
bb_player_PED_clean
##                Player                  Team        Date_Caught
## 1        Alex Sanchez  Tampa Bay Devil Rays      April 3, 2005
## 2     Agustin Montero         Texas Rangers     April 20, 2005
## 3        Jamal Strong      Seattle Mariners     April 26, 2005
## 4         Juan Rincon       Minnesota Twins        May 2, 2005
## 5   Rafael Betancourt     Cleveland Indians       July 8, 2005
## 6     Rafael Palmeiro     Baltimore Orioles     August 1, 2005
## 7       Ryan Franklin      Seattle Mariners     August 2, 2005
## 8          Mike Morse      Seattle Mariners  September 7, 2005
## 9     Carlos Almanzar         Texas Rangers    October 4, 2005
## 10      Felix Heredia         New York Mets   October 18, 2005
## 11        Matt Lawton      New York Yankees   November 2, 2005
## 12       Yusaku Iriki         New York Mets     April 28, 2006
## 13     Jason Grimsley  Arizona Diamondbacks      June 12, 2006
## 14     Guillermo Mota         New York Mets   November 1, 2006
## 15         Juan Salas  Tampa Bay Devil Rays        May 7, 2007
## 16        Neifi Perez        Detroit Tigers       July 6, 2007
## 17        Neifi Perez        Detroit Tigers     August 3, 2007
## 18       Mike Cameron      San Diego Padres   October 31, 2007
## 19       Dan Serafini      Colorado Rockies  November 27, 2007
## 20       Jose Guillen    Kansas City Royals   December 6, 2007
## 21        Jay Gibbons     Baltimore Orioles   December 6, 2007
## 22    Eliezer Alfonzo  San Francisco Giants     April 30, 2008
## 23       J. C. Romero Philadelphia Phillies    January 6, 2009
## 24      Manny Ramirez   Los Angeles Dodgers        May 7, 2009
## 25    Edinson Volquez       Cincinnati Reds     April 20, 2010
## 26      Manny Ramirez        Tampa Bay Rays      April 8, 2011
## 27    Eliezer Alfonzo      Colorado Rockies September 14, 2011
## 28     Guillermo Mota  San Francisco Giants        May 7, 2012
## 29      Freddy Galvis Philadelphia Phillies      June 19, 2012
## 30        Marlon Byrd            Free agent      June 25, 2012
## 31      Melky Cabrera  San Francisco Giants    August 15, 2012
## 32      Bartolo Colon     Oakland Athletics    August 22, 2012
## 33    Yasmani Grandal      San Diego Padres   November 7, 2012
## 34        Carlos Ruiz Philadelphia Phillies  November 27, 2012
## 35         Ryan Braun     Milwaukee Brewers      July 22, 2013
## 36        Nelson Cruz         Texas Rangers     August 5, 2013
## 37     Jhonny Peralta        Detroit Tigers     August 5, 2013
## 38     Everth Cabrera      San Diego Padres     August 5, 2013
## 39   Antonio Bastardo Philadelphia Phillies     August 5, 2013
## 40 Francisco Cervelli      New York Yankees     August 5, 2013
## 41     Alex Rodriguez      New York Yankees     August 5, 2013
## 42      Miguel Tejada    Kansas City Royals    August 17, 2013
## 43        Troy Patton     Baltimore Orioles  December 20, 2013
## 44     Cameron Maybin      San Diego Padres      July 23, 2014
## 45      David Rollins      Seattle Mariners     March 27, 2015
## 46      Ervin Santana       Minnesota Twins      April 3, 2015
## 47       Jenrry Mejia         New York Mets     April 11, 2015
## 48   Andrew McKirahan        Atlanta Braves     April 20, 2015
## 49       Jenrry Mejia         New York Mets      July 28, 2015
## 50       Cody Stanley   St. Louis Cardinals September 12, 2015
## 51       Jenrry Mejia         New York Mets  February 12, 2016
## 52    Abraham Almonte     Cleveland Indians  February 26, 2016
## 53      Daniel Stumpf Philadelphia Phillies     April 14, 2016
## 54    Chris Colabello     Toronto Blue Jays     April 22, 2016
## 55         Dee Gordon         Miami Marlins     April 29, 2016
## 56         Josh Ravin   Los Angeles Dodgers        May 2, 2016
## 57    Raul A. Mondesi    Kansas City Royals       May 10, 2016
## 58        Marlon Byrd     Cleveland Indians       June 1, 2016
## 59         Alec Asher Philadelphia Phillies      June 16, 2016
##                       Drug                 Penalty Position
## 1                                          10 days       OF
## 2                                          10 days        P
## 3                                          10 days       OF
## 4                                          10 days        P
## 5                                          10 days        P
## 6               Stanozolol                 10 days       DH
## 7                                          10 days        P
## 8                                          10 days       SS
## 9                                          10 days        P
## 10                                         10 days        P
## 11                                         10 days       OF
## 12                                        50 games        P
## 13                                        50 games        P
## 14                                        50 games        P
## 15                                        50 games        P
## 16                                        25 games       UT
## 17                                        80 games       UT
## 18                                        25 games       OF
## 19                                        50 games        P
## 20                                        15 games       OF
## 21                                        15 games       OF
## 22                                        50 games        C
## 23                                        50 games        P
## 24                                        50 games       OF
## 25                                        50 games        P
## 26                                       100 games       OF
## 27                                        48 games        C
## 28                                       100 games        P
## 29               Clostebol                50 games       UT
## 30               Tamoxifen                50 games       OF
## 31            Testosterone                50 games       OF
## 32            Testosterone                50 games        P
## 33            Testosterone                50 games        C
## 34                                        25 games        C
## 35                               Season (65 games)       OF
## 36                                        50 games       OF
## 37                                        50 games       SS
## 38                                        50 games       SS
## 39                                        50 games        P
## 40                                        50 games        C
## 41                         2014 season (162 games)       3B
## 42             Amphetamine               105 games       UT
## 43             Amphetamine                25 games        P
## 44                                        25 games       OF
## 45                                        80 games        P
## 46              Stanozolol                80 games        P
## 47              Stanozolol                80 games        P
## 48              Ipamorelin                80 games        P
## 49   Boldenone, Stanozolol               162 games        P
## 50                                        80 games        C
## 51               Boldenone            Lifetime Ban        P
## 52               Boldenone                80 games       OF
## 53               Turinabol                80 games        P
## 54               Turinabol                80 games       1B
## 55 Clostebol, Testosterone                80 games       2B
## 56             Pralmorelin                80 games        P
## 57                                        50 games       SS
## 58              Ipamorelin               162 games       OF
## 59               Turinabol                80 games        P

Exploratory Data Analysis

Here we will compare some player stats to get some insight

# graph baseball_ped user stats for a random set of people
# get random rows
PED_sample_rows <- sample(1:nrow(bb_player_PED_clean), 10 , replace = TRUE)

# get data indexed by those random rows
sample_baseball <- bb_player_PED_clean %>% slice(PED_sample_rows)

for (i in 1:nrow(sample_baseball)) {
  # get the year the baseball player was suspended and caught
  year <- regmatches(sample_baseball$Date_Caught[i],
                     regexpr("([0-9]){4}", sample_baseball$Date_Caught[i]))
  # plot the data (if it is a pitcher, display stats such as ERA, SO and BB)
    # split the Player name into first and last name to filter the data from
    # the Lahman database
    fname <- with(sample_baseball, head((str_split(Player[i], " "))[[1]], n = 1))
    lname <- with(sample_baseball, tail((str_split(Player[i], " "))[[1]], n = 1))
    if (sample_baseball$Position[i] == "P"){
      tmp <- baseball_pitching_data %>% 
        filter(grepl(fname, nameFirst),
               nameLast == lname)
      print(tmp)
      print(ggplot(data = tmp, aes(yearID, ERA)) + 
              geom_point(aes(color = "cyl")) + 
              geom_line(aes(color = "blue")) + 
              geom_vline(xintercept = as.integer(year)))
    }
    else {
       tmp <- baseball_batting_data %>% 
        filter(grepl(fname, nameFirst),
               nameLast == lname) 
       print(tmp)
       
       print(ggplot(data = tmp, aes(yearID, HR)) + 
               geom_point(aes(color = "cyl")) + 
               geom_line(aes(color = "blue")) + 
               geom_vline(xintercept = as.integer(year)))
    }
}
##     playerID yearID stint teamID lgID   G  AB   R   H 2B 3B HR RBI SB CS
## 1  peraljh01   2003     1    CLE   AL  77 242  24  55 10  1  4  21  1  3
## 2  peraljh01   2004     1    CLE   AL   8  25   2   6  1  0  0   2  0  1
## 3  peraljh01   2005     1    CLE   AL 141 504  82 147 35  4 24  78  0  2
## 4  peraljh01   2006     1    CLE   AL 149 569  84 146 28  3 13  68  0  1
## 5  peraljh01   2007     1    CLE   AL 152 574  87 155 27  1 21  72  4  4
## 6  peraljh01   2008     1    CLE   AL 154 605 104 167 42  4 23  89  3  1
## 7  peraljh01   2009     1    CLE   AL 151 582  57 148 35  1 11  83  0  2
## 8  peraljh01   2010     1    CLE   AL  91 334  37  82 23  2  7  43  1  0
## 9  peraljh01   2010     2    DET   AL  57 217  23  55  7  0  8  38  0  0
## 10 peraljh01   2011     1    DET   AL 146 525  68 157 25  3 21  86  0  2
## 11 peraljh01   2012     1    DET   AL 150 531  58 127 32  3 13  63  1  2
## 12 peraljh01   2013     1    DET   AL 107 409  50 124 30  0 11  55  3  3
## 13 peraljh01   2014     1    SLN   NL 157 560  61 147 38  0 21  75  3  2
## 14 peraljh01   2015     1    SLN   NL 155 579  64 159 26  1 17  71  1  4
##    BB  SO IBB HBP SH SF GIDP nameFirst nameLast      nameGiven bats throws
## 1  20  65   0   4  2  2    5    Jhonny  Peralta Jhonny Antonio    R      R
## 2   3   6   0   0  0  0    0    Jhonny  Peralta Jhonny Antonio    R      R
## 3  58 128   3   3  1  4   12    Jhonny  Peralta Jhonny Antonio    R      R
## 4  56 152   0   1  3  3   19    Jhonny  Peralta Jhonny Antonio    R      R
## 5  61 146   2   4  1  7   12    Jhonny  Peralta Jhonny Antonio    R      R
## 6  48 126   2   4  2  5   26    Jhonny  Peralta Jhonny Antonio    R      R
## 7  51 134   0   4  2  6   20    Jhonny  Peralta Jhonny Antonio    R      R
## 8  32  69   1   1  0  6    7    Jhonny  Peralta Jhonny Antonio    R      R
## 9  21  34   1   0  0  4    4    Jhonny  Peralta Jhonny Antonio    R      R
## 10 40  95   2   2  0  9   17    Jhonny  Peralta Jhonny Antonio    R      R
## 11 49 105   3   2  1  2   20    Jhonny  Peralta Jhonny Antonio    R      R
## 12 35  98   2   1  1  2    9    Jhonny  Peralta Jhonny Antonio    R      R
## 13 58 112   2   6  0  4   19    Jhonny  Peralta Jhonny Antonio    R      R
## 14 50 111   6   5  0  6   23    Jhonny  Peralta Jhonny Antonio    R      R
##         debut  finalGame
## 1  2003-06-12 2015-10-04
## 2  2003-06-12 2015-10-04
## 3  2003-06-12 2015-10-04
## 4  2003-06-12 2015-10-04
## 5  2003-06-12 2015-10-04
## 6  2003-06-12 2015-10-04
## 7  2003-06-12 2015-10-04
## 8  2003-06-12 2015-10-04
## 9  2003-06-12 2015-10-04
## 10 2003-06-12 2015-10-04
## 11 2003-06-12 2015-10-04
## 12 2003-06-12 2015-10-04
## 13 2003-06-12 2015-10-04
## 14 2003-06-12 2015-10-04

##     playerID yearID stint teamID lgID   G  AB   R   H 2B 3B HR RBI SB CS
## 1  ramirma02   1993     1    CLE   AL  22  53   5   9  1  0  2   5  0  0
## 2  ramirma02   1994     1    CLE   AL  91 290  51  78 22  0 17  60  4  2
## 3  ramirma02   1995     1    CLE   AL 137 484  85 149 26  1 31 107  6  6
## 4  ramirma02   1996     1    CLE   AL 152 550  94 170 45  3 33 112  8  5
## 5  ramirma02   1997     1    CLE   AL 150 561  99 184 40  0 26  88  2  3
## 6  ramirma02   1998     1    CLE   AL 150 571 108 168 35  2 45 145  5  3
## 7  ramirma02   1999     1    CLE   AL 147 522 131 174 34  3 44 165  2  4
## 8  ramirma02   2000     1    CLE   AL 118 439  92 154 34  2 38 122  1  1
## 9  ramirma02   2001     1    BOS   AL 142 529  93 162 33  2 41 125  0  1
## 10 ramirma02   2002     1    BOS   AL 120 436  84 152 31  0 33 107  0  0
## 11 ramirma02   2003     1    BOS   AL 154 569 117 185 36  1 37 104  3  1
## 12 ramirma02   2004     1    BOS   AL 152 568 108 175 44  0 43 130  2  4
## 13 ramirma02   2005     1    BOS   AL 152 554 112 162 30  1 45 144  1  0
## 14 ramirma02   2006     1    BOS   AL 130 449  79 144 27  1 35 102  0  1
## 15 ramirma02   2007     1    BOS   AL 133 483  84 143 33  1 20  88  0  0
## 16 ramirma02   2008     1    BOS   AL 100 365  66 109 22  1 20  68  1  0
## 17 ramirma02   2008     2    LAN   NL  53 187  36  74 14  0 17  53  2  0
## 18 ramirma02   2009     1    LAN   NL 104 352  62 102 24  2 19  63  0  1
## 19 ramirma02   2010     1    LAN   NL  66 196  32  61 15  0  8  40  1  1
## 20 ramirma02   2010     2    CHA   AL  24  69   6  18  1  0  1   2  0  0
## 21 ramirma02   2011     1    TBA   AL   5  17   0   1  0  0  0   1  0  0
##     BB  SO IBB HBP SH SF GIDP nameFirst nameLast        nameGiven bats
## 1    2   8   0   0  0  0    3     Manny  Ramirez Manuel Aristides    R
## 2   42  72   4   0  0  4    6     Manny  Ramirez Manuel Aristides    R
## 3   75 112   6   5  2  5   13     Manny  Ramirez Manuel Aristides    R
## 4   85 104   8   3  0  9   18     Manny  Ramirez Manuel Aristides    R
## 5   79 115   5   7  0  4   19     Manny  Ramirez Manuel Aristides    R
## 6   76 121   6   6  0 10   18     Manny  Ramirez Manuel Aristides    R
## 7   96 131   9  13  0  9   12     Manny  Ramirez Manuel Aristides    R
## 8   86 117   9   3  0  4    9     Manny  Ramirez Manuel Aristides    R
## 9   81 147  25   8  0  2    9     Manny  Ramirez Manuel Aristides    R
## 10  73  85  14   8  0  1   13     Manny  Ramirez Manuel Aristides    R
## 11  97  94  28   8  0  5   22     Manny  Ramirez Manuel Aristides    R
## 12  82 124  15   6  0  7   17     Manny  Ramirez Manuel Aristides    R
## 13  80 119   9  10  0  6   20     Manny  Ramirez Manuel Aristides    R
## 14 100 102  16   1  0  8   13     Manny  Ramirez Manuel Aristides    R
## 15  71  92  13   7  0  8   21     Manny  Ramirez Manuel Aristides    R
## 16  52  86   8   8  0  0   12     Manny  Ramirez Manuel Aristides    R
## 17  35  38  16   3  0  4    5     Manny  Ramirez Manuel Aristides    R
## 18  71  81  21   7  0  1    7     Manny  Ramirez Manuel Aristides    R
## 19  32  38   4   1  0  3    4     Manny  Ramirez Manuel Aristides    R
## 20  14  23   0   5  0  0    2     Manny  Ramirez Manuel Aristides    R
## 21   0   4   0   0  0  0    0     Manny  Ramirez Manuel Aristides    R
##    throws      debut  finalGame
## 1       R 1993-09-02 2011-04-06
## 2       R 1993-09-02 2011-04-06
## 3       R 1993-09-02 2011-04-06
## 4       R 1993-09-02 2011-04-06
## 5       R 1993-09-02 2011-04-06
## 6       R 1993-09-02 2011-04-06
## 7       R 1993-09-02 2011-04-06
## 8       R 1993-09-02 2011-04-06
## 9       R 1993-09-02 2011-04-06
## 10      R 1993-09-02 2011-04-06
## 11      R 1993-09-02 2011-04-06
## 12      R 1993-09-02 2011-04-06
## 13      R 1993-09-02 2011-04-06
## 14      R 1993-09-02 2011-04-06
## 15      R 1993-09-02 2011-04-06
## 16      R 1993-09-02 2011-04-06
## 17      R 1993-09-02 2011-04-06
## 18      R 1993-09-02 2011-04-06
## 19      R 1993-09-02 2011-04-06
## 20      R 1993-09-02 2011-04-06
## 21      R 1993-09-02 2011-04-06

##    playerID yearID stint teamID lgID W L  G GS CG SHO SV IPouts  H ER HR
## 1 salasju01   2006     1    TBA   AL 0 0  8  0  0   0  0     30 13  6  1
## 2 salasju01   2007     1    TBA   AL 1 1 34  0  0   0  0    109 36 15  7
## 3 salasju01   2008     1    TBA   AL 0 0  5  0  0   0  0     19  5  5  0
##   BB SO BAOpp  ERA IBB WP HBP BK BFP GF  R SH SF GIDP nameFirst nameLast
## 1  3  8 0.295 5.40   0  3   0  0  48  2  7  0  1           Juan    Salas
## 2 17 26 0.248 3.72   0  3   5  0 168 10 19  1  0           Juan    Salas
## 3  4  8 0.217 7.11   0  1   0  0  27  2  5  0  0           Juan    Salas
##   nameGiven bats throws      debut  finalGame
## 1      Juan    R      R 2006-09-05 2008-09-15
## 2      Juan    R      R 2006-09-05 2008-09-15
## 3      Juan    R      R 2006-09-05 2008-09-15

##    playerID yearID stint teamID lgID W L  G GS CG SHO SV IPouts  H ER HR
## 1 bastaan01   2009     1    PHI   NL 2 3  6  5  0   0  0     71 26 17  4
## 2 bastaan01   2010     1    PHI   NL 2 0 25  0  0   0  0     56 19  9  1
## 3 bastaan01   2011     1    PHI   NL 6 1 64  0  0   0  8    174 28 17  6
## 4 bastaan01   2012     1    PHI   NL 2 5 65  0  0   0  1    156 40 25  7
## 5 bastaan01   2013     1    PHI   NL 3 2 48  0  0   0  2    128 33 11  2
## 6 bastaan01   2014     1    PHI   NL 5 7 67  0  0   0  0    192 43 28  4
## 7 bastaan01   2015     1    PIT   NL 4 1 66  0  0   0  1    172 39 19  4
##   BB SO BAOpp  ERA IBB WP HBP BK BFP GF  R SH SF GIDP nameFirst nameLast
## 1  9 19 0.274 6.46   0  0   2  0 106  0 18  0  0        Antonio Bastardo
## 2  9 26 0.253 4.34   0  0   2  0  86  2  9  0  0        Antonio Bastardo
## 3 26 70 0.144 2.64   0  4   0  0 225 15 17  2  2        Antonio Bastardo
## 4 26 81 0.207 4.33   3  5   2  0 224 10 26  1  2        Antonio Bastardo
## 5 21 47 0.217 2.32   1  4   1  0 179 15 12  4  1        Antonio Bastardo
## 6 34 81 0.188 3.94   4  5   2  0 271 17 31  3  3    3   Antonio Bastardo
## 7 26 64 0.188 2.98   2  8   3  0 239 18 19  2  0        Antonio Bastardo
##           nameGiven bats throws      debut  finalGame
## 1 Antonio Francisco    R      L 2009-06-02 2015-10-02
## 2 Antonio Francisco    R      L 2009-06-02 2015-10-02
## 3 Antonio Francisco    R      L 2009-06-02 2015-10-02
## 4 Antonio Francisco    R      L 2009-06-02 2015-10-02
## 5 Antonio Francisco    R      L 2009-06-02 2015-10-02
## 6 Antonio Francisco    R      L 2009-06-02 2015-10-02
## 7 Antonio Francisco    R      L 2009-06-02 2015-10-02

##     playerID yearID stint teamID lgID  W  L  G GS CG SHO SV IPouts   H  ER
## 1  frankry01   1999     1    SEA   AL  0  0  6  0  0   0  0     34  10   6
## 2  frankry01   2001     1    SEA   AL  5  1 38  0  0   0  0    235  76  31
## 3  frankry01   2002     1    SEA   AL  7  5 41 12  0   0  0    356 117  53
## 4  frankry01   2003     1    SEA   AL 11 13 32 32  2   1  0    636 199  84
## 5  frankry01   2004     1    SEA   AL  4 16 32 32  2   1  0    601 224 109
## 6  frankry01   2005     1    SEA   AL  8 15 32 30  2   1  0    572 212 108
## 7  frankry01   2006     1    PHI   NL  1  5 46  0  0   0  0    159  59  27
## 8  frankry01   2006     2    CIN   NL  5  2 20  0  0   0  0     73  27  12
## 9  frankry01   2007     1    SLN   NL  4  4 69  0  0   0  1    240  70  27
## 10 frankry01   2008     1    SLN   NL  6  6 74  0  0   0 17    236  86  31
## 11 frankry01   2009     1    SLN   NL  4  3 62  0  0   0 38    183  49  13
## 12 frankry01   2010     1    SLN   NL  6  2 59  0  0   0 27    195  57  25
## 13 frankry01   2011     1    SLN   NL  1  4 21  0  0   0  1     83  44  26
##    HR BB  SO BAOpp  ERA IBB WP HBP BK BFP GF   R SH SF GIDP nameFirst
## 1   2  8   6     0 4.76   1  0   1  0  51  2   6                 Ryan
## 2  13 24  60  0.25 3.56   4  2   4  0 335 14  32  1  2           Ryan
## 3  14 22  65 0.255 4.02   1  0   5  0 495 10  62  5  5           Ryan
## 4  34 61  99 0.251 3.57   3  1   9  2 877  0  93  8  5           Ryan
## 5  33 61 104 0.285 4.90   1  0  10  3 870  0 116  2 11           Ryan
## 6  28 62  93  0.28 5.10   4  3   7  1 832  0 110  3  3           Ryan
## 7  10 17  25  0.28 4.58   4  1   4  0 233 13  28  0  1           Ryan
## 8   3 16  18 0.297 4.44   6  1   0  0 110  6  14  2  1           Ryan
## 9   8 11  44 0.234 3.04   0  2   3  0 317  8  28  2  2           Ryan
## 10 10 30  51 0.278 3.55   4  3   3  0 346 39  34  2  2           Ryan
## 11  2 24  44  0.22 1.92   3  1   1  0 250 54  13  0  2           Ryan
## 12  7 10  42  0.23 3.46   1  5   4  0 264 51  25  1  1           Ryan
## 13  9  7  17 0.367 8.46   2  1   1  0 133  9  27  4  1           Ryan
##    nameLast nameGiven bats throws      debut  finalGame
## 1  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 2  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 3  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 4  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 5  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 6  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 7  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 8  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 9  Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 10 Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 11 Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 12 Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28
## 13 Franklin  Ryan Ray    R      R 1999-05-15 2011-06-28