Process
Scenario A
A<-df4%>%
filter(Year==2012,between(Max.Ozone,75,75+0.905))
unique(A$GEOID)%>%length()
## [1] 349
unique(A$Date..Local.)%>%length()
## [1] 160
A<-left_join(A,pop12,by=c("GEOID"="fips"))
A.pop<-A%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value) # ALL OZONE LEVEL IS 75, So i think it have same kind of drought
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
A.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 349 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01049 70.9 132814089
## 2 01073 658. 132814089
## 3 01089 343. 132814089
## 4 04005 136. 132814089
## 5 04007 53.0 132814089
## 6 04012 20.5 132814089
## 7 04013 3948. 132814089
## 8 04017 107. 132814089
## 9 04021 382. 132814089
## 10 04027 203. 132814089
## # ℹ 339 more rows
### A2
A2<-df4%>%
filter(Year==2012,between(Max.Ozone,70,70+0.905))
unique(A2$GEOID)%>%length()
## [1] 517
unique(A2$Date..Local.)%>%length()
## [1] 196
A2<-left_join(A2,pop12,by=c("GEOID"="fips"))
A2.pop<-A2%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value) # ALL OZONE LEVEL IS 70
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
View(A2.pop)
A2.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 517 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01033 54.6 178745925
## 2 01051 80.2 178745925
## 3 01073 658. 178745925
## 4 01089 343. 178745925
## 5 01097 414. 178745925
## 6 01103 120. 178745925
## 7 04003 132. 178745925
## 8 04005 136. 178745925
## 9 04007 53.0 178745925
## 10 04012 20.5 178745925
## # ℹ 507 more rows
###A3
A3<-df4%>%
filter(Year==2012,between(Max.Ozone,51,51+0.905))
unique(A3$GEOID)%>%length()
## [1] 772
unique(A3$Date..Local.)%>%length()
## [1] 320
A3<-left_join(A3,pop12,by=c("GEOID"="fips"))
A3.pop<-A3%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value) # ALL OZONE LEVEL IS 51
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
View(A3.pop)
A3.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 772 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01003 190. 225735053
## 2 01033 54.6 225735053
## 3 01049 70.9 225735053
## 4 01051 80.2 225735053
## 5 01055 104. 225735053
## 6 01069 103. 225735053
## 7 01073 658. 225735053
## 8 01089 343. 225735053
## 9 01097 414. 225735053
## 10 01101 229. 225735053
## # ℹ 762 more rows
Scenario B
B<-df4%>%
filter(Year==2012,between(Max.Ozone,75,75+0.905)|between(Max.Ozone,75,75+1.693))
unique(B$GEOID)%>%length()
## [1] 442
unique(B$Date..Local.)%>%length()
## [1] 172
B<-left_join(B,pop12,by=c("GEOID"="fips"))
B.pop<-B%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value) # ALL OZONE LEVEL IS 75, So i think it have same kind of drought
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
B.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 442 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01049 70.9 158680441
## 2 01073 658. 158680441
## 3 01089 343. 158680441
## 4 01103 120. 158680441
## 5 01117 201. 158680441
## 6 04003 132. 158680441
## 7 04005 136. 158680441
## 8 04007 53.0 158680441
## 9 04012 20.5 158680441
## 10 04013 3948. 158680441
## # ℹ 432 more rows
### B2
B2<-df4%>%
filter(Year==2012,between(Max.Ozone,70,70+0.905)|between(Max.Ozone,70,70+1.693))
unique(B2$GEOID)%>%length()
## [1] 606
unique(B2$Date..Local.)%>%length()
## [1] 204
B2<-left_join(B2,pop12,by=c("GEOID"="fips"))
B2.pop<-B2%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value)
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
View(B2.pop)
B2.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 606 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01033 54.6 198796234
## 2 01049 70.9 198796234
## 3 01051 80.2 198796234
## 4 01073 658. 198796234
## 5 01089 343. 198796234
## 6 01097 414. 198796234
## 7 01103 120. 198796234
## 8 01113 57.5 198796234
## 9 04003 132. 198796234
## 10 04005 136. 198796234
## # ℹ 596 more rows
###B3
B3<-df4%>%
filter(Year==2012,between(Max.Ozone,51,51+0.905)|between(Max.Ozone,51,51+1.693))
unique(B3$GEOID)%>%length()
## [1] 775
unique(B3$Date..Local.)%>%length()
## [1] 337
B3<-left_join(B3,pop12,by=c("GEOID"="fips"))
B3.pop<-B3%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value)
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
View(B3.pop)
B3.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 775 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01003 190. 225894339
## 2 01033 54.6 225894339
## 3 01049 70.9 225894339
## 4 01051 80.2 225894339
## 5 01055 104. 225894339
## 6 01069 103. 225894339
## 7 01073 658. 225894339
## 8 01089 343. 225894339
## 9 01097 414. 225894339
## 10 01101 229. 225894339
## # ℹ 765 more rows
Scenario C
C<-df4%>%
filter(Year==2012,between(Max.Ozone,75,75+2.598)|between(Max.Ozone,75,75+1.693))
unique(C$GEOID)%>%length()
## [1] 488
unique(C$Date..Local.)%>%length()
## [1] 179
C<-left_join(C,pop12,by=c("GEOID"="fips"))
C.pop<-C%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value) # ALL OZONE LEVEL IS 75, So i think it have same kind of drought
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
C.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 488 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01049 70.9 172255515
## 2 01073 658. 172255515
## 3 01089 343. 172255515
## 4 01103 120. 172255515
## 5 01117 201. 172255515
## 6 04003 132. 172255515
## 7 04005 136. 172255515
## 8 04007 53.0 172255515
## 9 04012 20.5 172255515
## 10 04013 3948. 172255515
## # ℹ 478 more rows
### C2
C2<-df4%>%
filter(Year==2012,between(Max.Ozone,70,70+2.598)|between(Max.Ozone,70,70+1.693))
unique(C2$GEOID)%>%length()
## [1] 637
unique(C2$Date..Local.)%>%length()
## [1] 205
C2<-left_join(C2,pop12,by=c("GEOID"="fips"))
C2.pop<-C2%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value)
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
View(C2.pop)
C2.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 637 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01003 190. 202848364
## 2 01033 54.6 202848364
## 3 01049 70.9 202848364
## 4 01051 80.2 202848364
## 5 01073 658. 202848364
## 6 01089 343. 202848364
## 7 01097 414. 202848364
## 8 01103 120. 202848364
## 9 01113 57.5 202848364
## 10 04003 132. 202848364
## # ℹ 627 more rows
###C3
C3<-df4%>%
filter(Year==2012,between(Max.Ozone,51,51+2.598)|between(Max.Ozone,51,51+1.693))
unique(C3$GEOID)%>%length()
## [1] 776
unique(C3$Date..Local.)%>%length()
## [1] 340
C3<-left_join(C3,pop12,by=c("GEOID"="fips"))
C3.pop<-C3%>%
distinct(GEOID,MonitorID,.keep_all = T)%>%
group_by(GEOID,MonitorID,Max.Ozone)%>%
summarise(pop=value)
## `summarise()` has grouped output by 'GEOID', 'MonitorID'. You can override
## using the `.groups` argument.
View(C3.pop)
C3.pop%>%
group_by(GEOID)%>%
summarise(Pop=mean(pop))%>%
mutate(Sumpop=sum(Pop,na.rm = T)*1000)
## # A tibble: 776 × 3
## GEOID Pop Sumpop
## <chr> <dbl> <dbl>
## 1 01003 190. 226634039
## 2 01033 54.6 226634039
## 3 01049 70.9 226634039
## 4 01051 80.2 226634039
## 5 01055 104. 226634039
## 6 01069 103. 226634039
## 7 01073 658. 226634039
## 8 01089 343. 226634039
## 9 01097 414. 226634039
## 10 01101 229. 226634039
## # ℹ 766 more rows