Dataset

#Load Ozone Dataset
load("Ozone_Drought_Final.RData")
combinedAir.final<-arrange(combinedAir.final,GEOID,Year)

#Load Population Dataset
m.pop<-read_xlsx("Population/Population County.xlsx")

Merge and Filter

#Merge two datset
combinedAir.final<-left_join(combinedAir.final,m.pop,by=c("Year","GEOID"="fips"))

#Filter base on category, on July 15, 2012
combine2015<-combinedAir.final%>%
  filter(Date..Local.=="2012-07-15")

combine2015<-combine2015%>%distinct(Date..Local.,GEOID,.keep_all = T)

## Check available Population
sum(combine2015$value,na.rm = T)*1000
## [1] 225487857
## Check Available Observation in 2012-07-15
nrow(combine2015)
## [1] 756
# Generating Class for favor category
## 1st category is Between 70-1.416
## 2nd Category is Between 70-3.065 
## 3rd Category is Between 70-1.416
## 4th Category is Between 70+3.065
## 5th Category is other.
combine2015$Class<-0
combine2015$Class<-ifelse(between(combine2015$Max.Ozone,70-1.416,70),yes = 1,
                          ifelse(between(combine2015$Max.Ozone,70-3.065,70),yes = 2,
                                 ifelse(between(combine2015$Max.Ozone,70,70+1.416),yes = 3,
                                        ifelse(between(combine2015$Max.Ozone,70,70+3.065),yes = 4,5))))

Summary Population Total

Here Total population Estimate base on last population cencus.

Total county is less than 1000 it is because effect of number of observation, some county may have no observation in that period of time.

sumed.pop<-combine2015%>%
  group_by(Class)%>%
  summarise(Total_pop=sum(value,na.rm = T)*1000,
            County=n(),
            list=paste(County.Name, collapse = ", "))

sumed.pop
## # A tibble: 5 × 4
##   Class Total_pop County list                                                   
##   <dbl>     <dbl>  <int> <chr>                                                  
## 1     1   8638484     15 Kern, Tulare, Cook, Jersey, McLean, LaPorte, Shawnee, …
## 2     2   4222414     15 Tuolumne, Douglas, Larimer, Porter, Harrison, Linn, Mo…
## 3     3   1083935      5 Fresno, Mariposa, Riley, Essex, Dewey                  
## 4     4    562782      3 Lake, Clinton, Clinton                                 
## 5     5 210980242    718 Baldwin, Colbert, DeKalb, Elmore, Etowah, Houston, Jef…