From 793c8f734fabb9dc3ea9abf29f93d324493ffa3b Mon Sep 17 00:00:00 2001 From: Alex Gebben Work Date: Thu, 6 Aug 2026 17:12:14 -0600 Subject: [PATCH] Intial commit. Pulling multipliers --- Tapestry.r | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Tapestry.r diff --git a/Tapestry.r b/Tapestry.r new file mode 100644 index 0000000..3170bbb --- /dev/null +++ b/Tapestry.r @@ -0,0 +1,21 @@ +library(tidyverse) +library(readxl) + +GET_MULTIPLIERS <- function(STATE,YEAR=2024,VERSION='1.5.6'){ + FILE <- paste0(STATE,"_",YEAR,"_SAM_v",VERSION,"/",STATE,"_leontief_",YEAR,".xlsx") +TYPE1 <- read_xlsx(FILE,'I-Ainv_type1') +TYPE2 <- read_xlsx(FILE,'I-Ainv_type2') +NROW1 <- nrow(TYPE1) +NROW2 <- nrow(TYPE2) +NAMES <- strsplit(colnames(TYPE1[NROW1,2:NROW1]),"_") %>% unlist +NAICS <- NAMES[seq(1,976,by=2)] +Industry_Name <- NAMES[seq(2,976,by=2)] +Indirect <- as.numeric(TYPE1[NROW1,2:NROW1]) +Induced <- as.numeric(TYPE2[NROW2,2:(NROW2-6)]) +return(cbind(NAICS,Industry_Name,Indirect,Induced) %>% as_tibble %>% mutate(Indirect=as.numeric(Indirect),Induced=as.numeric(Induced)) %>% mutate(State=STATE,Total=Induced,Induced=Induced-Indirect,Indirect=Indirect-1) %>% select(State,everything())) +} +ALL <- full_join(full_join(GET_MULTIPLIERS("Arizona"),GET_MULTIPLIERS("Arkansas")),GET_MULTIPLIERS("California")) %>% full_join(GET_MULTIPLIERS("Wyoming")) +ggplot(ALL,aes(x=State,y=Total,color=State)) + geom_boxplot() + + +