#Juliette Pardue, Mridul Sen, Christos Tsolakis
##1. Scatterplot matrix of passing yards, passing TDs, passer rating, rushing yards, and rushing TDs
##2. Bar chart of passing yards per player (best displayed as a horizontal bar chart), with conference as color
##3. Bar chart of the average of one of the statistics for each conference
# 1. scatterplot matrix of passing yards, passing TDs, passer rating, rushing yards, and rushing TDs
pairs(passing.stats.2014[,c("Passing.Yards","Passing.TD","Rate","Rushing.Yards","Rushing.TD")])
# 2. bar chart of passing yards per player (best displayed as a horizontal bar chart), with conference as color
storingdata = read.csv("passing-stats-2014.csv")//Reading from file
barplot(storingdata$Passing.Yards,names.arg=storingdata$Player,
las=1,main="Number of Passing yards per Player",horiz=TRUE,cex.names=.5,
col = c("red","green","yellow","brown","black","chocolate4","blueviolet","hotpink", //Barplot(Horizontal)of passing yards per player
"darkseagreen4","blue","darkgray")[as.numeric(storingdata$Conf)],
ylim=c(0,150),yaxs="i",xlim=c(0,4500))
legend("topright", c("ACC","American","Big12","Big10","CUSA","Ind","MAC","MWC","Pac12","SEC","Sunbelt"),pch=15,
col=c("red","green","yellow","brown","black","chocolate4","blueviolet","hotpink",
"darkseagreen4","blue","darkgray"),bty="n") //Legends to define which color is for what conference
# 3. bar chart of the average of one of the statistics for each conference
storingdata = read.csv("passing-stats-2014.csv")//Reading from file
aggregate(Passing.Attempts ~ Conf, storingdata, FUN = function(Passing.Attempts)c(mean(Passing.Attempts)))//Aggregating the mean passing attempts per conference
new<-aggregate(Passing.Attempts ~ Conf, storingdata, FUN = function(Passing.Attempts)c(mean(Passing.Attempts))) //Storing the aggregated result into new
data1<-new$Conf
barplot(new$Passing.Attempts,names.arg = data1,las=1,horiz=TRUE,xlab="Average Passing Attempts",
ylab="Conferences",main="Average Passing Attempts per Conference",cex.names=.8,col = c('darkslategray1')) //Plotting the mean passing attempts per conference horizontally