AIR QUALITY DATA SET

SRI SANJAY N

22071A05Q1 DATE : 10-10-2023

They contain data about the New York Air Quality Measurements of 1973 for five months from May to September recorded daily.

We are using the ggplot2 to obtain plots between parameters such as ozone,solar radiation,winds and temperatures. After each plot we draw conclusions upon the patterns obtained in the plots.

summary(airquality)
##      Ozone           Solar.R           Wind             Temp      
##  Min.   :  1.00   Min.   :  7.0   Min.   : 1.700   Min.   :56.00  
##  1st Qu.: 18.00   1st Qu.:115.8   1st Qu.: 7.400   1st Qu.:72.00  
##  Median : 31.50   Median :205.0   Median : 9.700   Median :79.00  
##  Mean   : 42.13   Mean   :185.9   Mean   : 9.958   Mean   :77.88  
##  3rd Qu.: 63.25   3rd Qu.:258.8   3rd Qu.:11.500   3rd Qu.:85.00  
##  Max.   :168.00   Max.   :334.0   Max.   :20.700   Max.   :97.00  
##  NA's   :37       NA's   :7                                       
##      Month            Day      
##  Min.   :5.000   Min.   : 1.0  
##  1st Qu.:6.000   1st Qu.: 8.0  
##  Median :7.000   Median :16.0  
##  Mean   :6.993   Mean   :15.8  
##  3rd Qu.:8.000   3rd Qu.:23.0  
##  Max.   :9.000   Max.   :31.0  
## 
str(airquality)
## 'data.frame':    153 obs. of  6 variables:
##  $ Ozone  : int  41 36 12 18 NA 28 23 19 8 NA ...
##  $ Solar.R: int  190 118 149 313 NA NA 299 99 19 194 ...
##  $ Wind   : num  7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ...
##  $ Temp   : int  67 72 74 62 56 66 65 59 61 69 ...
##  $ Month  : int  5 5 5 5 5 5 5 5 5 5 ...
##  $ Day    : int  1 2 3 4 5 6 7 8 9 10 ...
#gg <- ggplot(airquality, aes(x = x_var, y = y_var))

PLOTTING GRAPHS USING GGPLOT PACKAGE

plot(airquality)

OZONE VS SOLAR RADIATION

library(ggplot2)
ggplot(airquality, aes(x = Solar.R, y = Ozone)) +
  geom_point() +
  labs(x = "Solar Radiation (Solar.R)", y = "Ozone Concentration (Ozone)",
       title = "Scatterplot of Ozone vs. Solar Radiation")
## Warning: Removed 42 rows containing missing values (`geom_point()`).

Conclusion: The scatter plot shows weak positive correlation between ozone concentration and solar radiation. When solar radiation is higher, ozone concentration tends to be higher as well.

HISTOGRAM OF WIND SPEED

ggplot(airquality, aes(x = Wind)) +
  geom_histogram(binwidth = 2, fill = "blue", color = "black") +
  labs(title = "Histogram of Wind Speed",
       x = "Wind Speed (mph)",
       y = "Frequency")

BOXPLOT : OZONE BY MONTH

ggplot(airquality, aes(x = factor(Month), y = Ozone)) +
  geom_boxplot(fill = "orange") +
  labs(title = "Boxplot of Ozone by Month",
       x = "Month",
       y = "Ozone (ppm)")
## Warning: Removed 37 rows containing non-finite values (`stat_boxplot()`).

Conclusion: The boxplot displays the variation in ozone concentration by month. Ozone levels tend to be higher in the summer months (June, July, and August) compared to other months.

LINE PLOT : TEMPERATURE OVER TIME

ggplot(airquality, aes(x = Day, y = Temp, group = Month, color = factor(Month))) +
  geom_line() +
  labs(title = "Temperature Over Time",
       x = "Day of the Month",
       y = "Temperature (°F)") +
  scale_color_discrete(name = "Month")

Conclusion: The line plot shows the temperature trend over time for each month. It illustrates the seasonal variation in temperature, with higher temperatures in the summer months and lower temperatures in the winter months.

DENSITY PLOT:WINDSPEED DISTRIBUTION

ggplot(airquality, aes(x = Wind)) +
  geom_density(fill = "purple") +
  labs(title = "Density Plot of Wind Speed",
       x = "Wind Speed (mph)",
       y = "Density")

Conclusion: The density plot illustrates the distribution of wind speed, providing insights into the data’s density and potential modes.

```