# Reads data for coastal counties in Oregon, for 2022.

NOEP_oregon = "https://oceaneconomics.org/api/CoastalPH/econData?years=2022&geoid=41007,41009,41011,41015,41019,41039,41041,41051,41057"

result <- GET(NOEP_oregon)

Oregon_coastal = fromJSON(rawToChar(result$content))
names(Oregon_coastal)
##  [1] "geoId"          "stateName"      "geoName"        "year"          
##  [5] "superSector"    "establishments" "employment"     "wages"         
##  [9] "wagesCPI"       "gdp"            "realGDP"        "population"    
## [13] "housing"        "area"
unique_counties = levels(as.factor(Oregon_coastal$geoName))
unique_counties
## [1] "Clatsop"   "Columbia"  "Coos"      "Curry"     "Douglas"   "Lane"     
## [7] "Lincoln"   "Multnomah" "Tillamook"
unique_sectors = levels(as.factor(Oregon_coastal$superSector))
unique_sectors
##  [1] "Construction"                        
##  [2] "Education and Health Services"       
##  [3] "Financial Activities"                
##  [4] "Information"                         
##  [5] "Leisure and Hospitality"             
##  [6] "Manufacturing"                       
##  [7] "Natural Resources and Mining"        
##  [8] "Other Services"                      
##  [9] "Professional and Business Services"  
## [10] "Public Administration"               
## [11] "Total, all industries"               
## [12] "Trade, Transportation, and Utilities"
## [13] "Unclassified"
table <- select(filter(Oregon_coastal, geoName == "Tillamook"),
    5:11)

kable(table, table.attr = "style = \"color: black;\"", caption = "<span style='font-size:large'>Data for Tillamook Co., Oregon 2022</span>",
    digits = 3, format = "html", booktabs = T, linesep = "") |>
    kable_styling("striped")
Data for Tillamook Co., Oregon 2022
superSector establishments employment wages wagesCPI gdp realGDP
Total, all industries 1117 9827 483559153 405016212 1141099305 977594610
Construction 112 478 33672535 28203215 56107443 42604920
Financial Activities 57 188 10964899 9183906 84272738 72893029
Education and Health Services 191 2020 108262750 90677984 108058443 96591843
Information 18 56 2518887 2109752 7867462 8546212
Leisure and Hospitality 158 1551 44675957 37419387 107350689 87025017
Manufacturing 33 1561 95868899 80297225 221562051 197002380
Natural Resources and Mining 88 756 36197124 30317743 78539543 54970542
Other Services 83 330 9807672 8214644 21688747 17298144
Professional and Business Services 108 413 24693680 20682766 40661287 40101573
Public Administration 36 557 34054227 28522910 188158524 162150747
Trade, Transportation, and Utilities 190 1774 76635218 64187609 184392652 136028820
Unclassified 44 19 1246242 1043819 0 0