Loading

블로그채널

Search !

[R] Chap2 Ex1 Top Base Stealers in the Hall of Frame


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