Skip to main content
100%

In Class Work 2

✓ Published0🌍 Public
MMrajyalakshmi
Last edited Feb 3, 2016
Created on Feb 3, 2016

This example explores football statistics through three visualizations created in R. It first presents a scatterplot matrix examining correlations between passing yards, passing touchdowns, passer rating, rushing yards, and rushing touchdowns, highlighting the minimal correlation between passing and rushing yards. A horizontal bar chart then displays passing yards per player, using the ggplot2 library’s `geom_bar` function with player conference encoded as fill color. Finally, it shows average interceptions per conference using `stat_summary` with the mean function, revealing differences in interception rates across groups. The data originates from a CSV file loaded via `read.csv`.

AI-generated description

Team members:

Ravi Teja Majeti

Shivani bimavarapu

Rajyalakshmi Mukkamala

###1) Scatterplot matrix of passing yards, passing TDs, passer rating, rushing yards, and rushing TDs R image

Correlation between each pair of attribute is observed and minimum correlation observed between passing yards and rushing yards.

##R code:


football <- read.csv(file.choose())


pairs(~Passing.Yards+Passing.TD+Rate+Rushing.Yards+Rushing.TD, data=football, pch = 21, col = c("magenta", "forestgreen", "blue2"), main="Scatterplot Matrix")

##2)Bar chart of passing yards per player (best displayed as a horizontal bar chart), with conference as color

R image

Statistics of passing yards of each player where players are grouped by conference as a color.

##R code:


football <- read.csv(file.choose())

 library(ggplot2)
 
 
ggplot(data=football, aes(x=Player, y=Passing.Yards, fill=Conf)) +
geom_bar(stat="identity", position=position_dodge()) + coord_flip() + ggtitle('Passing yards per player with conference as color')

##3)Bar chart of the average of one of the statistics for each conference

R image

Average of interceptions of each conference, highest and lowest interceptions can be observed.

##R code:


football <- read.csv(file.choose())

 library(ggplot2)
 
 
ggplot(data=football, aes(x=Conf, y=Interceptions)) + stat_summary(fun.y="mean", geom="bar") + ggtitle('Average Interceptions in each Conference')

Similar vizzes