Top Batting Averages Over Time
Top Batting Averages Over Time reference:http://www.baseball-databank.org/ ShortI'm going to use plyr and ggplot2 to look at how top batting averages have changed over time First load the data:
options(width = 100)<br>library(ggplot2)<br>
## Warning message: package 'ggplot2' was built under R version 2.14.2<br>
library(plyr)<br><br>data(baseball)<br>head(baseball)<br>
## id year stint team lg g ab r h X2b X3b hr rbi sb cs bb so ibb hbp sh sf gidp<br>## 4 ansonca01 1871 1 RC1 25 120 29 39 11 3 0 16 6 2 2 1 NA NA NA NA NA<br>## 44 forceda01 1871 1 WS3 32 162 45 45 9 4 0 29 8 0 4 0 NA NA NA NA NA<br>## 68 mathebo01 1871 1 FW1 19 89 15 24 3 1 0 10 2 1 2 0 NA NA NA NA NA<br>## 99 startjo01 1871 1 NY2 33 161 35 58 5 1 1 34 4 2 3 0 NA NA NA NA NA<br>## 102 suttoez01 1871 1 CL1 29 128 35 45 3 7 3 23 3 1 1 0 NA NA NA NA NA<br>## 106 whitede01 1871 1 CL1 29 146 40 47 6 5 1 21 2 2 4 1 NA NA NA NA NA<br>
It looks like we've loaded the data successfully. Next, ...
[Read more...]