# Load and Clean Data
# Merge Pennsylvania and New Jersey industry files
gdp_industry <- bind_rows(
read_csv("../data/CAGDP2_GPD_PA_Industry.csv", skip = 3) |> clean_names(),
read_csv("../data/CAGDP2_GPD_NJ_Industry.csv", skip = 3) |> clean_names()
)
# Using Private industries sub-categories only (excluding aggregates to avoid double counting)
gdp_industry <- gdp_industry |>
mutate(
x2022 = as.numeric(x2022),
x2023 = as.numeric(x2023),
x2024 = as.numeric(x2024)
)
# AI-assisted
greater_philly_total <- gdp_industry |>
filter(str_detect(geo_name, "Philadelphia, PA|Montgomery, PA|Bucks, PA|Chester, PA|Delaware, PA|Gloucester, NJ|Camden, NJ|Burlington, NJ")) |>
filter(line_code == 1) |>
select(geo_name, description, x2022, x2023, x2024) |>
mutate(pct_24_v_22 = round((x2024 - x2022) / x2022, 4)) |>
arrange(desc(pct_24_v_22))
greater_philly_industry <- gdp_industry |>
filter(str_detect(geo_name, "Philadelphia, PA|Montgomery, PA|Bucks, PA|Chester, PA|Delaware, PA|Gloucester, NJ|Camden, NJ|Burlington, NJ")) |>
filter(description %in% c(
"Agriculture, forestry, fishing and hunting",
"Mining, quarrying, and oil and gas extraction",
"Utilities",
"Construction",
"Manufacturing",
"Wholesale trade",
"Retail trade",
"Transportation and warehousing",
"Information",
"Finance, insurance, real estate, rental, and leasing",
"Professional and business services",
"Educational services, health care, and social assistance",
"Arts, entertainment, recreation, accommodation, and food services",
"Other services (except government and government enterprises)"
)) |>
select(geo_name, description, x2022, x2024) |>
mutate(pct_24_v_22 = round((x2024 - x2022) / x2022, 4)) |>
mutate(x24_v_22 = x2024 - x2022) |>
arrange(desc(x24_v_22))
greater_philly_industry |>
slice_min(x24_v_22, n = 10) |>
select(geo_name, description, x24_v_22)