Compare commits

..

No commits in common. "62083a05472e79a204bb57321c33484febc03b52" and "87ac709ff70649278d837c18338dacdc6274db63" have entirely different histories.

View File

@ -1,15 +1,15 @@
library(tidyverse) library(tidyverse)
#install.packages("paletteer") #install.packages("paletteer")
library(scales)
library(paletteer) library(paletteer)
DATA_DIR <- 'Results/REMI_Output/' DATA_DIR <- 'Results/REMI_Outputs'
OUTPUT_DIR <- './Results/Figures/' OUTPUT_DIR <- './Results/Figures'
dir.create(OUTPUT_DIR,recursive=TRUE,showWarnings=FALSE) dir.create(OUTPUT_DIR,recursive=TRUE,showWarnings=FALSE)
######################Employments ######################Employments
EMPLOY <- read_csv(paste0(DATA_DIR,"Direct, Indirect, and Induced -Employment.csv" ),skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year)) EMPLOY <- read_csv("Results/Direct, Indirect, and Induced -Employment.csv",skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year))
EMPLOY_NUM <- EMPLOY %>% filter(Units=='Individuals (Jobs)') %>% select(-Units,Employment=value) %>% filter(Year>=2028) EMPLOY_NUM <- EMPLOY %>% filter(Units=='Individuals (Jobs)') %>% select(-Units,Employment=value) %>% filter(Year>=2028)
EMPLOY_NUM <- rbind(EMPLOY_NUM %>% filter(!(Year %in% c(2028,2029))) ,EMPLOY_NUM %>% filter(Year==2028) %>% mutate(Year=2029.74),EMPLOY_NUM %>% filter(Year==2029) %>% mutate(Year=2029.75)) EMPLOY_NUM <- rbind(EMPLOY_NUM %>% filter(!(Year %in% c(2028,2029))) ,EMPLOY_NUM %>% filter(Year==2028) %>% mutate(Year=2029.74),EMPLOY_NUM %>% filter(Year==2029) %>% mutate(Year=2029.75))
EMPLOY_NUM$Category <- gsub(" Employment","",EMPLOY_NUM$Category) EMPLOY_NUM$Category <- gsub(" Employment","",EMPLOY_NUM$Category)
EMPLOY_NUM$Category <- factor(EMPLOY_NUM$Category,levels=rev(c("Direct","Indirect","Induced","Total"))) EMPLOY_NUM$Category <- factor(EMPLOY_NUM$Category,levels=rev(c("Direct","Indirect","Induced","Total")))
@ -19,12 +19,13 @@ COOL_DOWN <- as.numeric(EMPLOY_NUM[5,3])
df <- data.frame(Year=c(2032.5,2034.25,2046,2059.8),Employment=c(MAX_VAL,COOL_DOWN,791+20,743+20),text=c("Peak of 2,530","Stablized at 961","Midpoint of 791","Ends at 743")) df <- data.frame(Year=c(2032.5,2034.25,2046,2059.8),Employment=c(MAX_VAL,COOL_DOWN,791+20,743+20),text=c("Peak of 2,530","Stablized at 961","Midpoint of 791","Ends at 743"))
JOB_PLOT <- ggplot(EMPLOY_NUM %>% filter(Category!="Total"),aes(x=Year,y=Employment))+geom_area(position = "stack",aes(fill=Category,group=Category))+theme_bw()+scale_x_continuous(breaks=c(2028,seq(2025,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=EMPLOY_NUM %>% filter(Category=="Total"),size=1)+geom_text(data=df,aes(label = text), vjust = "inward", hjust = "inward")+theme(legend.position = "top") JOB_PLOT <- ggplot(EMPLOY_NUM %>% filter(Category!="Total"),aes(x=Year,y=Employment))+geom_area(position = "stack",aes(fill=Category,group=Category))+theme_bw()+scale_x_continuous(breaks=c(2028,seq(2025,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=EMPLOY_NUM %>% filter(Category=="Total"),size=1)+geom_text(data=df,aes(label = text), vjust = "inward", hjust = "inward")+theme(legend.position = "top")
png(paste0(OUTPUT_DIR,"Job_plot.png" ) , units = "in", width = 10, height = 8, res = 600) png("Job_plot.png", units = "in", width = 10, height = 8, res = 600)
JOB_PLOT JOB_PLOT
dev.off() dev.off()
#JOB_PLOT JOB_PLOT
###################Output graph ###################
OUTPUT <- read_csv(paste0(DATA_DIR,"Direct, Indirect, and Induced -Output.csv" ),skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year)) OUTPUT <- read_csv("Results/Direct, Indirect, and Induced -Output.csv",skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year))
OUTPUT
OUTPUT_NUM <- OUTPUT %>% filter(Units=='Thousands of Fixed (2025) Dollars') %>% select(-Units,Output=value) %>% filter(Year>=2028) %>% mutate(Output=Output/1000) OUTPUT_NUM <- OUTPUT %>% filter(Units=='Thousands of Fixed (2025) Dollars') %>% select(-Units,Output=value) %>% filter(Year>=2028) %>% mutate(Output=Output/1000)
OUTPUT_NUM <- rbind(OUTPUT_NUM %>% filter(!(Year %in% c(2028,2029))) ,OUTPUT_NUM %>% filter(Year==2028) %>% mutate(Year=2029.74),OUTPUT_NUM %>% filter(Year==2029) %>% mutate(Year=2029.75)) OUTPUT_NUM <- rbind(OUTPUT_NUM %>% filter(!(Year %in% c(2028,2029))) ,OUTPUT_NUM %>% filter(Year==2028) %>% mutate(Year=2029.74),OUTPUT_NUM %>% filter(Year==2029) %>% mutate(Year=2029.75))
@ -43,25 +44,9 @@ COOL_DOWN <- as.numeric(OUTPUT_NUM[5,3])
df <- data.frame(Year=c(2032.5,2034.25,2059.8),Output=c(MAX_VAL,COOL_DOWN,337),text=c("Peak of $658 Million","Stablized at $273 Million ","Ends at $337 Million")) df <- data.frame(Year=c(2032.5,2034.25,2059.8),Output=c(MAX_VAL,COOL_DOWN,337),text=c("Peak of $658 Million","Stablized at $273 Million ","Ends at $337 Million"))
#OUTPUT_PLOT <- #OUTPUT_PLOT <-
OUTPUT_NUM %>% filter(Year==2033) OUTPUT_NUM %>% filter(Year==2033)
OUTPUT_PLOT <- ggplot(OUTPUT_NUM %>% filter(Category!="Total"),aes(x=Year,y=Output))+geom_area(position = "stack",aes(fill=Category,group=Category))+theme_bw()+scale_x_continuous(breaks=c(2028,seq(2025,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=OUTPUT_NUM %>% filter(Category=="Total"),size=1) ggplot(OUTPUT_NUM %>% filter(Category!="Total"),aes(x=Year,y=Output))+geom_area(position = "stack",aes(fill=Category,group=Category))+theme_bw()+scale_x_continuous(breaks=c(2028,seq(2025,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=OUTPUT_NUM %>% filter(Category=="Total"),size=1)
#+geom_text(data=df,aes(label = text), vjust = "inward", hjust = "inward")+theme(legend.position = "top") +geom_text(data=df,aes(label = text), vjust = "inward", hjust = "inward")+theme(legend.position = "top")
png(paste0(OUTPUT_DIR,"Output_plot.png"), units = "in", width = 10, height = 8, res = 600) png("Output_plot.png", units = "in", width = 10, height = 8, res = 600)
OUTPUT_PLOT OUTPUT_PLOT
dev.off() dev.off()
###################
INDUSTRY_JOBS <- read_csv(paste0(DATA_DIR,'Employment- By Industry - Employment by Industry.csv'),skip=5) %>% pivot_longer(c(-Industry,-Units),names_to="Year") %>% mutate(Jobs=parse_number(value),Year=parse_number(Year)) %>% select(-value) %>% filter(Industry!='All Industries') %>% select(-Units) %>% filter(Year>=2029)
INDUSTRY_JOBS <- INDUSTRY_JOBS %>% group_by(Year) %>% mutate(Rank=rank(-Jobs)) %>% mutate(Rank=ifelse(Rank>10,11,Rank),Industry=ifelse(Rank==11,"Other",Industry)) %>% group_by(Year,Industry,Rank) %>% summarize(Jobs=sum(Jobs)) %>% ungroup(Industry,Rank) %>% arrange(Year,Rank)
ORDER <- c(INDUSTRY_JOBS %>% filter(Industry!='Other') %>% group_by(Industry) %>% summarize(MEAN=mean(Jobs)) %>% arrange(desc(MEAN)) %>% pull(Industry) %>% unique,"Other")
INDUSTRY_JOBS$Industry <- factor(INDUSTRY_JOBS$Industry,levels=ORDER)
JOB_TYPE_PLOT <- ggplot(INDUSTRY_JOBS ,aes(x=Year,y=Jobs,fill=Industry))+geom_bar(stat='identity')+ paletteer::scale_fill_paletteer_d("colorBlindness::Blue2DarkRed18Steps")
png(paste0(OUTPUT_DIR,"Job_Dist_Plot.png"), units = "in", width = 20, height = 8, res = 600)
JOB_TYPE_PLOT
dev.off()
ggplot(INDUSTRY_JOBS %>% filter(Year %in% c(2032,2045)),aes(x=as.factor(Year),y=Jobs,fill=Industry))+geom_bar(stat='identity')+ paletteer::scale_fill_paletteer_d("colorBlindness::Blue2DarkRed18Steps")