Lloyd Decker
The code used to generate the R charts:
footballData <- read.csv("http://cs.odu.edu/~ldecker/passing-stats-2014.csv", header=TRUE, sep=",");
# scatterplot matrix of passing yards, passing TDs, passer rating, rushing yards, and rushing TDs
specificData <- subset(footballData, select=-c(Rk,Player,School,Conf,Cmp,Passing.Attempts,Pct,Y.A,AY.A,Interceptions,Rushing.Attempts,Rushing.Avg))
pairs(specificData)
# bar chart of passing yards per player (best displayed as a horizontal bar chart), with conference as color
getConferenceColor <- function(conf)
{
ifelse(conf=='ACC',"darkslateblue",
ifelse(conf=='American',"darkmagenta",
ifelse(conf=='Big 12',"brown1",
ifelse(conf=='Big Ten',"cornflowerblue",
ifelse(conf=='CUSA',"chocolate4",
ifelse(conf=='Ind',"chocolate",
ifelse(conf=='MAC',"chartreuse4",
ifelse(conf=='MWC',"yellow",
ifelse(conf=='Pac-12',"chartreuse",
ifelse(conf=='SEC', "cadetblue",
ifelse(conf=='Sun Belt',"hotpink4",
"black")))))))))))
}
conferenceColor <- unique(playerData$Conf, incomparables = FALSE);
playerData <- subset (footballData, select=c(Player, Passing.Yards, Conf));
param <- par(mar = c(5, 6, 3, 2) + 0.1);
barplot(playerData$Passing.Yards,
horiz=TRUE,
xlab="Passing Yards",
names.arg=playerData$Player,
cex.names=0.4,
las=1,
col=getConferenceColor(playerData$Conf),
xlim=c(0,5000));
legend(4100, 140, conferenceColor, col=c(getConferenceColor(conferenceColor)), lty=1, lwd=8, cex =.5);
# bar chart of the average of one of the statistics for each conference
conferenceData <- subset(footballData, select = c(Rushing.Attempts, Conf));
averageData <- aggregate(Rushing.Attempts ~ Conf, conferenceData, mean);
param <- par(mar = c(5,5,3,5) + 0.1);
barplot(averageData$Rushing.Attempts,
names.arg=averageData$Conf,
col=getConferenceColor(averageData$Conf),
las=2,
ylim=c(0, 120),
xlim=c(0,18),
cex.names=0.8,
xlab="Conferences",
ylab="Average Rushing Attempt");
legend(13.5, 100 , conferenceColor, col = c(getConferenceColor(conferenceColor)), lty = 1, lwd = 5, cex = 0.5);
Scatterplot matrix of passing yards, passing TDs, passer rating, rushing yards, and rushing TDs
Bar chart of passing yards per player (best displayed as a horizontal bar chart), with conference as color
Bar chart of the average of one of the statistics for each conference