Chapter 2. Exercises 1.
Top Base Stealers in the Hall of Frame
Analyzing Baseball Data with R, Introduction to R, page 56
The flollowing table gives the number of stolen bases (SB), the number of times caught stealing (CS), and the number of games played (G) for nine players currently inducted in the Hall of Frame.
Player |
SB |
CS |
G |
Rickey Henderson |
1406 |
335 |
3081 |
Lou Brock |
938 |
307 |
2616 |
Ty Cobb |
897 |
212 |
3034 |
Eddie Collins |
741 |
195 |
2826 |
Max Carey |
738 |
109 |
2476 |
Joe Morgan |
689 |
162 |
2649 |
Luis Aparicio |
506 |
136 |
2599 |
Paul Molitor |
504 |
131 |
2683 |
Roberto Alomar |
474 |
114 |
2379 |
(a) In R, place the stolen base, caught stealing, and game counts in the vectors SB, CS, and G.
SB <- c(1406, 938, 897, 741, 738, 689, 506, 504, 474) CS <- c(335, 307, 212, 195, 109, 162, 136, 131, 114) G <- c(3081, 2616, 3034, 2826, 2476, 2649, 2599, 2683, 2379)
(b) For all players, compute the number of stolen base attempts SB + CS and store in the vector SB.Attempt.
SB.Attempt <- SB + CS
(c) For all players, compute the success rate Success.Rate = SB / SB.Attempt
Success.Rate <- SB / SB.Attempt
(d) Compute the number of stolen bases per game SB.Game = SB / Game.
SB.Game <- SB / G
(e) Construct a scatterplot of the stolen bases per game against the success rates.
plot(Success.Rate, SB.Game)
Are there particular players with unusually high or low stolen base success rates?
Max Carey -> high
Lou Brock -> low
Which player had the greates number of stolen bases per game?
Rickey Henderson
Analyzing Baseball Data with R, Introduction to R
'컴퓨터 언어 > R' 카테고리의 다른 글
[R] Chap2 Ex5 Pitcher Strikeout / Walk Ratios (0) | 2015.02.04 |
---|---|
[R] Chap2 Ex4 subset function strikeout-walk ratios (0) | 2015.02.01 |
[R] Chap2 Ex3 Pitchers in the 350 Wins Club (0) | 2015.01.31 |
[R] Chap2 Ex2 Character, Factor, and Logical Variables in R (0) | 2015.01.30 |
R 통계 프로그램 사용법 및 설치 매뉴얼 다운로드 소개 (11) | 2015.01.27 |