Major League Baseball Data from the 1986 and 1987 seasons.
HittersA data frame with 322 observations of major league players on the following 20 variables.
AtBatNumber of times at bat in 1986
HitsNumber of hits in 1986
HmRunNumber of home runs in 1986
RunsNumber of runs in 1986
RBINumber of runs batted in in 1986
WalksNumber of walks in 1986
YearsNumber of years in the major leagues
CAtBatNumber of times at bat during his career
CHitsNumber of hits during his career
CHmRunNumber of home runs during his career
CRunsNumber of runs during his career
CRBINumber of runs batted in during his career
CWalksNumber of walks during his career
LeagueA factor with levels A and N
indicating player's league at the end of 1986
DivisionA factor with levels E and W
indicating player's division at the end of 1986
PutOutsNumber of put outs in 1986
AssistsNumber of assists in 1986
ErrorsNumber of errors in 1986
Salary1987 annual salary on opening day in thousands of dollars
NewLeagueA factor with levels A and N
indicating player's league at the beginning of 1987
James, G., Witten, D., Hastie, T., and Tibshirani, R. (2013) An Introduction to Statistical Learning with applications in R, https://www.statlearning.com, Springer-Verlag, New York
# NOT RUN {
summary(Hitters)
lm(Salary~AtBat+Hits,data=Hitters)
# }
Run the code above in your browser using DataLab