Beachhead Assignment Approach

Data 607, Beachead Assignment
Author

Mubin Ejaz

The Problem:

There is a common understanding that factors such as pollution, traffic, industry waste and etc affect air quality and environment.

It would be interesting to see how airquality has been affected for the last very many years and what factors have most affect on it. I will only be focusing on New York.

Airquality Dataset (s)

For the beachhead assignment, I have chosen outdoor air quality data from EPA.gov (it queries dataset csv from AirNow).

Possible Challenges

I would like to see how the Ozone’s value has changed over the period of last some years, and how that has affected air quality in New York.

I downloaded the csv from Download Daily Data | US EPA (air quality summary statistics for criteria pollutants by monitor for new york)

The EPA.gov website allows you to download various pollutant and corresponding daily data. I would be experimenting with both data sets.

Considering this will be the first time I’ll be using R, the learning curve maybe a challenge. Taking a small enough chunk of the data that shows a meaningful conclusion might be another challenge.

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.1     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
AirData<-read.csv("ad_viz_plotval_data.csv")
glimpse(AirData)
Rows: 6,452
Columns: 21
$ Date                                 <chr> "01/01/2026", "01/02/2026", "01/0…
$ Source                               <chr> "AQS", "AQS", "AQS", "AQS", "AQS"…
$ Site.ID                              <int> 360010012, 360010012, 360010012, …
$ POC                                  <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
$ Daily.Max.8.hour.Ozone.Concentration <dbl> 0.040, 0.033, 0.038, 0.034, 0.023…
$ Units                                <chr> "ppm", "ppm", "ppm", "ppm", "ppm"…
$ Daily.AQI.Value                      <int> 37, 31, 35, 31, 21, 12, 22, 21, 2…
$ Local.Site.Name                      <chr> "LOUDONVILLE", "LOUDONVILLE", "LO…
$ Daily.Obs.Count                      <int> 17, 17, 17, 17, 17, 17, 17, 17, 1…
$ Percent.Complete                     <dbl> 100, 100, 100, 100, 100, 100, 100…
$ AQS.Parameter.Code                   <int> 44201, 44201, 44201, 44201, 44201…
$ AQS.Parameter.Description            <chr> "Ozone", "Ozone", "Ozone", "Ozone…
$ Method.Code                          <int> 87, 87, 87, 87, 87, 87, 87, 87, 8…
$ CBSA.Code                            <int> 10580, 10580, 10580, 10580, 10580…
$ CBSA.Name                            <chr> "Albany-Schenectady-Troy, NY", "A…
$ State.FIPS.Code                      <int> 36, 36, 36, 36, 36, 36, 36, 36, 3…
$ State                                <chr> "New York", "New York", "New York…
$ County.FIPS.Code                     <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
$ County                               <chr> "Albany", "Albany", "Albany", "Al…
$ Site.Latitude                        <dbl> 42.68075, 42.68075, 42.68075, 42.…
$ Site.Longitude                       <dbl> -73.75733, -73.75733, -73.75733, …
AirData %>%
mutate(Date = as.Date(Date, format = "%m/%d/%Y")) %>%
filter(Date >= "2026-09-01") %>% 
ggplot(aes(x=Date, y=Daily.Max.8.hour.Ozone.Concentration))+geom_line(color="blue") + labs(title="Daily Ozone Concentration this Year in New York")

Possible Solution:

I would be sticking with a few datasets for this assignment, but experimenting with dataset I download from EPA.gov website. I’ll try to compare different polutants and ozone data.


AI Usage:

ChatGPT, GPT-5.6 Luna.

Prompt:

I’ve loaded a csv file in variable AirData (got the data from EPA.gov. Is this correct way to filter out last few months of dates ? filter(AirData$date>=“2026-05-01”) %>% ggplot(data=AirData, mapping=aes(x=Date, y=Daily.Max.8.hour.Ozone.Concentration))+geom_line(color=“blue”) + labs(title=“Daily Ozone Concentration this Year in New York”)

Response:

You’re very close — there are just a couple of things to fix.

1. Your filter() is correct in principle

If your date column is actually called date and is stored as a proper Date:

filter(AirData, date >= "2026-05-01")

or in a pipe:

AirData %>%   filter(date >= "2026-05-01")

2. The main issue is that your filtered data isn’t being passed to ggplot()

You currently have:

filter(AirData$date >= "2026-05-01") %>%   ggplot(data = AirData, mapping = aes(...))

The ggplot() is then told to use AirData again, so it ignores the filtered result.

Instead:

AirData %>%   filter(date >= "2026-05-01") %>%   ggplot(aes(x = date, y = Daily.Max.8.hour.Ozone.Concentration)) +   geom_line(color = "blue") +   labs(title = "Daily Ozone Concentration this Year in New York")

After learning how to actually filter, I was able to also mutate the Date to be used as an int instead of char.