Major League Baseball Data from the 1986 and 1987 seasons.

Hitters

Format

A data frame with 322 observations of major league players on the following 20 variables.

AtBat

Number of times at bat in 1986

Hits

Number of hits in 1986

HmRun

Number of home runs in 1986

Runs

Number of runs in 1986

RBI

Number of runs batted in in 1986

Walks

Number of walks in 1986

Years

Number of years in the major leagues

CAtBat

Number of times at bat during his career

CHits

Number of hits during his career

CHmRun

Number of home runs during his career

CRuns

Number of runs during his career

CRBI

Number of runs batted in during his career

CWalks

Number of walks during his career

League

A factor with levels A and N indicating player's league at the end of 1986

Division

A factor with levels E and W indicating player's division at the end of 1986

PutOuts

Number of put outs in 1986

Assists

Number of assists in 1986

Errors

Number of errors in 1986

Salary

1987 annual salary on opening day in thousands of dollars

NewLeague

A factor with levels A and N indicating player's league at the beginning of 1987

Source

This dataset was taken from the StatLib library which is maintained at Carnegie Mellon University. This is part of the data that was used in the 1988 ASA Graphics Section Poster Session. The salary data were originally from Sports Illustrated, April 20, 1987. The 1986 and career statistics were obtained from The 1987 Baseball Encyclopedia Update published by Collier Books, Macmillan Publishing Company, New York.

References

James, G., Witten, D., Hastie, T., and Tibshirani, R. (2013) An Introduction to Statistical Learning with applications in R, www.StatLearning.com, Springer-Verlag, New York

Examples

summary(Hitters)
#> AtBat Hits HmRun Runs #> Min. : 16.0 Min. : 1 Min. : 0.00 Min. : 0.00 #> 1st Qu.:255.2 1st Qu.: 64 1st Qu.: 4.00 1st Qu.: 30.25 #> Median :379.5 Median : 96 Median : 8.00 Median : 48.00 #> Mean :380.9 Mean :101 Mean :10.77 Mean : 50.91 #> 3rd Qu.:512.0 3rd Qu.:137 3rd Qu.:16.00 3rd Qu.: 69.00 #> Max. :687.0 Max. :238 Max. :40.00 Max. :130.00 #> #> RBI Walks Years CAtBat #> Min. : 0.00 Min. : 0.00 Min. : 1.000 Min. : 19.0 #> 1st Qu.: 28.00 1st Qu.: 22.00 1st Qu.: 4.000 1st Qu.: 816.8 #> Median : 44.00 Median : 35.00 Median : 6.000 Median : 1928.0 #> Mean : 48.03 Mean : 38.74 Mean : 7.444 Mean : 2648.7 #> 3rd Qu.: 64.75 3rd Qu.: 53.00 3rd Qu.:11.000 3rd Qu.: 3924.2 #> Max. :121.00 Max. :105.00 Max. :24.000 Max. :14053.0 #> #> CHits CHmRun CRuns CRBI #> Min. : 4.0 Min. : 0.00 Min. : 1.0 Min. : 0.00 #> 1st Qu.: 209.0 1st Qu.: 14.00 1st Qu.: 100.2 1st Qu.: 88.75 #> Median : 508.0 Median : 37.50 Median : 247.0 Median : 220.50 #> Mean : 717.6 Mean : 69.49 Mean : 358.8 Mean : 330.12 #> 3rd Qu.:1059.2 3rd Qu.: 90.00 3rd Qu.: 526.2 3rd Qu.: 426.25 #> Max. :4256.0 Max. :548.00 Max. :2165.0 Max. :1659.00 #> #> CWalks League Division PutOuts Assists #> Min. : 0.00 A:175 E:157 Min. : 0.0 Min. : 0.0 #> 1st Qu.: 67.25 N:147 W:165 1st Qu.: 109.2 1st Qu.: 7.0 #> Median : 170.50 Median : 212.0 Median : 39.5 #> Mean : 260.24 Mean : 288.9 Mean :106.9 #> 3rd Qu.: 339.25 3rd Qu.: 325.0 3rd Qu.:166.0 #> Max. :1566.00 Max. :1378.0 Max. :492.0 #> #> Errors Salary NewLeague #> Min. : 0.00 Min. : 67.5 A:176 #> 1st Qu.: 3.00 1st Qu.: 190.0 N:146 #> Median : 6.00 Median : 425.0 #> Mean : 8.04 Mean : 535.9 #> 3rd Qu.:11.00 3rd Qu.: 750.0 #> Max. :32.00 Max. :2460.0 #> NA's :59
lm(Salary~AtBat+Hits,data=Hitters)
#> #> Call: #> lm(formula = Salary ~ AtBat + Hits, data = Hitters) #> #> Coefficients: #> (Intercept) AtBat Hits #> 141.272 -1.216 8.212 #>