library(plm)
library(knitr)
library(stringr)
library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plm':
## 
##     between, lag, lead
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union

—- Data —-

df <- load('Ozone_Drought_Final.RData')

df2 <- combinedAir.final %>%
    mutate(month = as.numeric(month))

df3 <- read.csv("region_code.csv")

df2$State.Code = as.numeric(df2$State.Code)
df4 <- df2 %>%
    merge(df3, by = "State.Code")

— State per Region —

# Northeast
ne <- df4 %>%
    filter(noaa_region == "northeast")
table(ne$State.Name)
## 
##   Connecticut      Delaware         Maine      Maryland Massachusetts 
##         45237         36522         72052         81900         80822 
## New Hampshire    New Jersey      New York  Pennsylvania  Rhode Island 
##         54437         92562        204367        266427         12291 
##       Vermont 
##         13608
# Northern Rockies
nr <- df4 %>%
    filter(noaa_region == "northern_rockies")
table(nr$State.Name)
## 
##      Montana     Nebraska North Dakota South Dakota      Wyoming 
##        27445        20570        53715        29065        96111
# Northwest
nw <- df4 %>%
    filter(noaa_region == "northwest")
table(nw$State.Name)
## 
##      Idaho     Oregon Washington 
##      16726      29932      58680
# Ohio Valley
ov <- df4 %>%
    filter(noaa_region == "ohio_valley")
table(ov$State.Name)
## 
##      Illinois       Indiana      Kentucky      Missouri          Ohio 
##        222933        159538        145986        108163        210218 
##     Tennessee West Virginia 
##        122048         37594
# South
sth <- df4 %>%
    filter(noaa_region == "south")
table(sth$State.Name)
## 
##    Arkansas      Kansas   Louisiana Mississippi    Oklahoma       Texas 
##       49622       59176      168012       49329      141245      484102
# Southeast
se <- df4 %>%
    filter(noaa_region == "southeast")
table(se$State.Name)
## 
##        Alabama        Florida        Georgia North Carolina South Carolina 
##         110697         373548          98400         183364         107455 
##       Virginia 
##         108927
# Southwest
sw <- df4 %>%
    filter(noaa_region == "southwest")
table(sw$State.Name)
## 
##    Arizona   Colorado New Mexico       Utah 
##     256448     185357     146628      95097
# Upper Midwest
uw <- df4 %>%
    filter(noaa_region == "upper_midwest")
table(uw$State.Name)
## 
##      Iowa  Michigan Minnesota Wisconsin 
##     76215    110141     61660    134339
# West
wst <- df4 %>%
    filter(noaa_region == "west")
table(wst$State.Name)
## 
## California     Nevada 
##    1142955     147761