R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Project Description: Air quality is a huge factor when considering a lifestyle in certain locations. I moved to the US from India when I was four and recently revisited last year. I also visited Illinois last year to visit family friends whom live near Champaign County.For that reason I thought it would be interesting to see how their air qualities differ and how different pollutants can factor into the air quality being more of a risk factor or not.

## [1] "Year"                          "Days.Rated.Less.than.Moderate"
##  [1] "City"      "AQI"       "PM2.5"     "PM10"      "O3"        "NO2"      
##  [7] "SO2"       "CO"        "Latitude"  "Longitude" "Time"
## 'data.frame':    44 obs. of  2 variables:
##  $ Year                         : int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
##  $ days_rated_less_than_moderate: int  5 4 6 18 10 7 4 7 23 10 ...
## tibble [153 Ă— 12] (S3: tbl_df/tbl/data.frame)
##  $ City       : chr [1:153] "Gulzarpet, Anantapur, India" "Anand Kala Kshetram, Rajamahendravaram, India" "Tirumala-APPCB, Tirupati, India" "PWD Grounds, Vijayawada, India" ...
##  $ air_quality: chr [1:153] "88" "58" "110" "-" ...
##  $ pm2_5      : chr [1:153] "88" "58" "110" "52" ...
##  $ pm_10      : chr [1:153] "71" "45" "53" "N/A" ...
##  $ O3         : chr [1:153] "26.3" "14.6" "15" "5.1" ...
##  $ NO2        : chr [1:153] "4.6" "12" "13.8" "0.7" ...
##  $ SO2        : chr [1:153] "2.4" "6.9" "1.8" "4.9" ...
##  $ CO         : chr [1:153] "6.5" "6.7" "9" "4.2" ...
##  $ Latitude   : num [1:153] 14.7 17 13.7 16.5 27.1 ...
##  $ Longitude  : num [1:153] 77.6 81.7 79.3 80.6 93.7 ...
##  $ Time       : chr [1:153] "2024-05-04 18:00:00" "2024-05-04 18:00:00" "2024-05-04 18:00:00" "2020-11-19 16:00:00" ...
##  $ city       : chr [1:153] "Gulzarpet Anantapur India" "Anand Kala Kshetram Rajamahendravaram India" "Tirumala-APPCB Tirupati India" "PWD Grounds Vijayawada India" ...
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `date = mdy(Time)`.
## Caused by warning:
## ! All formats failed to parse. No formats found.
##  [1] "city"        "air_quality" "pm2_5"       "pm_10"       "o3"         
##  [6] "no2"         "so2"         "co"          "latitude"    "longitude"  
## [11] "time"        "city_2"      "date"
## Warning: There were 6 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `across(c(pm2_5, pm_10, o3, no2, so2, co), as.numeric)`.
## Caused by warning:
## ! NAs introduced by coercion
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 5 remaining warnings.

Cleaning and Scraping the Data: The data sets were from xlsx and csv files. I cleaned up some of the data using different methods which we learned throughout the entirety of the course. I renamed a few variables from both data sets. I used the “mutate” function to make some of the city names easier to work with and I also used the “mutate” function for parsing a few dates and working to adjust some of the variables as numeric values.

This graph does the job of showing how air quality has progressed throughout the years in Champaign County. As the graph declines and gets constantly fluctuates but ultimately gets less, which tells us that there has been heightened pollution. For a small period, we can see very few unhealthy air quality days but as the years go on and especially closer to today we can see a potential reversal which signals current environmental challenges.

Graphs

##  [1] "city"        "air_quality" "pm2_5"       "pm_10"       "o3"         
##  [6] "no2"         "so2"         "co"          "latitude"    "longitude"  
## [11] "time"        "city_2"      "date"

This graph shows the air quality for cities throughout the country of India. Kadri, Mangalore shows the highest reported AQI(air quality index) at almost 800. Cities such as New Delhi and Vapi also have very bad air qualities which highlight the air pollution challenges among the country. Comparing this to the Champaign County air quality data we can see a huge difference.

## Warning: No renderer available. Please install the gifski, av, or magick package to
## create animated output

This graph shows an animation which portrays the air quality in India overtime but with the differentiation of the pollutant concentrations. The two different pollutants being PM 2.5 and PM 10. PM stands for particulate matter and so PM 2.5 means particulate matter that are 2.5 micrometers or less in diameter and same with PM 10 but instead of 2.5 it would be 10 micrometers or less. PM 2.5 is considered more dangerous and linked to more serious health consequences of poor air quality.Through this graph we see that PM 2.5 is significantly higher throughout the years than PM 10.

## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 7 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_point()`).
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 17 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 17 rows containing missing values or values outside the scale range
## (`geom_point()`).

This graph shows more of an individual breakdown of PM 2.5 and PM 10 vs the air quality. As you can see the outlier in each graph indicate the city of Kadri. The PM 2.5 graph also has a tighter linear association than PM 10 which tells us that it is a higher indicator of air quality problems.

## Warning: Removed 41 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 41 rows containing missing values or values outside the scale range
## (`geom_point()`).

Finally this graph brings together both the locations in terms of air quality throughout the years. As we can clearly see, India has far worst of an air quality index than Champaign County. We can also see that while in Champaign County there have been significantly lower numbers, the sharper peaks in India indicate the persistent challenges India faces with air quality. Overall, this graph wraps up all the data in a nice way which shows and tells us the ongoing challenges in environmental conditions between both locations. And although Illinois is not as bad as India, it is still important to care about our ecological footprint and make sure we are trying our best to combat with these environmental hardships.

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Final Acknowledgements: I am grateful for being able to present this data in a way which I wouldn’t have able to before taking this class so thanks to Professor Buyske so teaching me these new skills and despite this being an online and asynchronous course I was able to learn a great amount.

Appendix: As far as AI for this final project, I used it to help me organize my data better. I gave it a few of the column names and concepts of my data to help me organize my data in a way which would give me some ideas of what graphs to make and what initial variables would be compatible and useful in comparing with each other.