###Using Airline Stats Data
data<-read.csv("airline_stats.csv")
View(data)
###summaries and Tables
summary(data$pct_carrier_delay)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.000 4.145 6.357 7.041 9.140 100.000 28
x<-table(data$airline)
x
##
## Alaska American Delta Jet Blue Southwest United
## 3851 5725 9107 3775 5584 5426
summary(data$pct_atc_delay, data$pct_weather_delay)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.000 2.147 3.900 5.090 6.630 100.000 28
###Plotting
table(data$airline)
##
## Alaska American Delta Jet Blue Southwest United
## 3851 5725 9107 3775 5584 5426
barplot(table(data$airline) ,
xlab="Airline" ,
ylab="Number" ,
main="Respondents by Airline" ,
col="#e5e5ff")
table(data$airline)
##
## Alaska American Delta Jet Blue Southwest United
## 3851 5725 9107 3775 5584 5426
barplot(table(data$airline) ,
xlab="Airline" ,
ylab="Number" ,
main="Respondents by Airline" ,
col="#d4e6f4" ,
horiz=T)
boxplot(data$pct_carrier_delay~data$airline, col='#cda4a4')
hist(data$pct_atc_delay , breaks=100 , col='#cda4a4')
par(mfrow=c(1,2))
plot(data$pct_carrier_delay,data$pct_weather_delay, col='#04444e')
plot(data$pct_weather_delay,data$pct_carrier_delay, col='#04444e')
library("ggplot2")
data1<-read.csv("airline_stats.csv")
ggplot(data=data1)+
geom_point(aes(x=pct_carrier_delay,y=pct_atc_delay, alpha=pct_carrier_delay), col='#04444e')
## Warning: Removed 28 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(data=data1)+
geom_point(aes(x=pct_carrier_delay,y=pct_atc_delay, shape=airline), col='#04444e')
## Warning: Removed 28 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(data=data)+
geom_point(aes(x=pct_carrier_delay,y=pct_atc_delay, col=airline))
## Warning: Removed 28 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(data=data)+
geom_point(aes(x=pct_carrier_delay,y=airline), col="Red")
## Warning: Removed 28 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(data=data1)+
geom_point(aes(x=pct_weather_delay,y=pct_carrier_delay, alpha=pct_weather_delay), col='#d1a03a')+
facet_wrap(~airline, ncol=2)
## Warning: Removed 28 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(data=data)+
geom_bar(aes(x=pct_carrier_delay, col=airline))
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_count()`).
p<-ggplot(data=data, aes(airline, pct_carrier_delay))
p
p+
geom_boxplot()
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
p+geom_boxplot() + coord_flip()
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
p+geom_boxplot(notch=TRUE, col ="#d1a03a")
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
p + geom_boxplot(varwidth = TRUE)
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
p + geom_boxplot(fill = "#c4dec1", colour = "#314839")
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
p + geom_boxplot(outlier.colour = "#49a596", outlier.shape = 4)
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
p +
geom_boxplot(outlier.shape = NA) +
geom_jitter(width = 0.2, alpha=0.09)
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 28 rows containing missing values or values outside the scale range
## (`geom_point()`).
p + geom_boxplot(aes(col= airline))
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_boxplot()`).
q<-ggplot(data=data, aes(pct_carrier_delay))
q+
geom_histogram()+
geom_freqpoly(col="Red")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_bin()`).
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 28 rows containing non-finite outside the scale range
## (`stat_bin()`).