library(flexdashboard)
## Warning: package 'flexdashboard' was built under R version 4.0.4
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(vioplot)
## Warning: package 'vioplot' was built under R version 4.0.4
## Loading required package: sm
## Warning: package 'sm' was built under R version 4.0.4
## Package 'sm', version 2.2-5.6: type help(sm) for summary information
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 4.0.4
library(RColorBrewer)
# Download and pre-process the data for visualization

  
OtherAnly <- select(airquality, Month, Day, Ozone, Solar.R, Wind, Temp)

OtherAnly$Month[OtherAnly$Month == 5] <- "May"
OtherAnly$Month[OtherAnly$Month == 6] <- "June"
OtherAnly$Month[OtherAnly$Month == 7] <- "July"
OtherAnly$Month[OtherAnly$Month == 8] <- "August"
OtherAnly$Month[OtherAnly$Month == 9] <- "September"

AirQuality Parameters

Row

Ozone

## Month-wise Ozone Variability

par(mfrow=c(2,2))
o1 <- ggplot(OtherAnly, aes(x=Month, y=Ozone, fill=Month))
o1 +  geom_boxplot(notch = TRUE, notchwidth = 0.5) + scale_x_discrete(limits=c("May", "June","July", "August","September")) + ggtitle("Box-plot") + theme_minimal() + theme(legend.position="none")
## Warning: Removed 37 rows containing non-finite values (stat_boxplot).
## notch went outside hinges. Try setting notch=FALSE.

o1 +  geom_violin() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-plot") + theme(legend.position="none")
## Warning: Removed 37 rows containing non-finite values (stat_ydensity).

o1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")
## Warning: Removed 37 rows containing non-finite values (stat_ydensity).

## Warning: Removed 37 rows containing non-finite values (stat_boxplot).

Solar Radiation

## Month-wise Solar Radiation Variability

par(mfrow=c(2,2))
s1 <- ggplot(OtherAnly, aes(x=Month, y=Solar.R, fill=Month))
s1 +  geom_boxplot(notch = TRUE, notchwidth = 0.5) + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Box-plot") + theme_minimal() + theme(legend.position="none")
## Warning: Removed 7 rows containing non-finite values (stat_boxplot).
## notch went outside hinges. Try setting notch=FALSE.
## notch went outside hinges. Try setting notch=FALSE.

s1 +  geom_violin() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-plot") + theme(legend.position="none")
## Warning: Removed 7 rows containing non-finite values (stat_ydensity).

s1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")
## Warning: Removed 7 rows containing non-finite values (stat_ydensity).

## Warning: Removed 7 rows containing non-finite values (stat_boxplot).

Wind

## Month-wise Wind Variability

par(mfrow=c(2,2))
w1 <- ggplot(OtherAnly, aes(x=Month, y=Wind, fill=Month))
w1 +  geom_boxplot(notch = TRUE, notchwidth = 0.5) + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Box-plot") + theme_minimal() + theme(legend.position="none")

w1 +  geom_violin() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-plot") + theme(legend.position="none")

w1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")

Temperature

## Month-wise Temperature Variability

par(mfrow=c(2,2))
t1 <- ggplot(OtherAnly, aes(x=Month, y=Temp, fill=Month))
t1 +  geom_boxplot(notch = TRUE, notchwidth = 0.5) + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Box-plot") + theme_minimal() + theme(legend.position="none")

t1 +  geom_violin() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-plot") + theme(legend.position="none")

t1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")

## Month-wise Ozone Variability

#par(mfrow=c(2,2))
#o1 <- ggplot(OtherAnly, aes(x=Month, y=Ozone, fill=Month))

#o1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")
## Month-wise Solar Radiation Variability

#par(mfrow=c(2,2))
#s1 <- ggplot(OtherAnly, aes(x=Month, y=Solar.R, fill=Month))

#s1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")
## Month-wise Wind Variability

#par(mfrow=c(2,2))
#w1 <- ggplot(OtherAnly, aes(x=Month, y=Wind, fill=Month))

#w1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")
## Month-wise Temperature Variability

#par(mfrow=c(2,2))
#t1 <- ggplot(OtherAnly, aes(x=Month, y=Temp, fill=Month))

#t1 +  geom_violin() + geom_boxplot() + theme_minimal() + scale_x_discrete(limits=c("May", "June", "July", "August","September")) + ggtitle("Violin-Boxplot") + theme(legend.position="none")