Fixed typo of wrong year and figure size

This commit is contained in:
Alex Gebben Work 2025-12-15 12:42:41 -07:00
parent a5b30bfde4
commit f34c85ee50
2 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ png(paste0(SAVE_RES_LOC,"Migration_Fan_Chart_Upper_Bound.png"), width = 12, heig
dev.off() dev.off()
#####Key year table #####Key year table
KEY <- RES %>% filter(Year %in% c(2029,2030,2035,2045,2055,2065)) KEY <- RES %>% filter(Year %in% c(2027,2030,2035,2045,2055,2065))
AVG_VALUES <- KEY %>% group_by(Year) %>% summarize(MED=median(Population),MEAN=mean(Population)) AVG_VALUES <- KEY %>% group_by(Year) %>% summarize(MED=median(Population),MEAN=mean(Population))
AVG_VALUES <- rbind(AVG_VALUES[,1:2]%>% rename(Value=MED) %>% mutate('Summary Stat.'="Median"),AVG_VALUES[,c(1,3)] %>% rename(Value=MEAN) %>% mutate('Summary Stat.'="Mean")) AVG_VALUES <- rbind(AVG_VALUES[,1:2]%>% rename(Value=MED) %>% mutate('Summary Stat.'="Median"),AVG_VALUES[,c(1,3)] %>% rename(Value=MEAN) %>% mutate('Summary Stat.'="Mean"))
@ -60,7 +60,7 @@ dev.off()
#rm(KEY_YEARS) #rm(KEY_YEARS)
POP_LEVELS <- seq(2000,6000,100) POP_LEVELS <- seq(2000,6000,100)
YEARS <- c(2030,2035,2045,2055,2065) YEARS <- c(2027,2030,2035,2045,2055,2065)
if(exists("KEY_YEARS")){rm(KEY_YEARS)} if(exists("KEY_YEARS")){rm(KEY_YEARS)}
for(i in YEARS ){ for(i in YEARS ){
KEY <- RES %>% filter(Year==i ) %>% pull(Population) KEY <- RES %>% filter(Year==i ) %>% pull(Population)
@ -77,5 +77,5 @@ PLOT_RED <- "red"
KEY_YEARS <- KEY_YEARS%>% as.data.frame KEY_YEARS <- KEY_YEARS%>% as.data.frame
Capacity_Risk <- KEY_YEARS%>% gt(rownames_to_stub = TRUE,caption="Year") %>% data_color( fn = scales::col_numeric( palette = c(PLOT_RED, PLOT_YELLOW, PLOT_GREEN), domain = c(0, 1) ) ) %>% fmt_percent( decimals = 1, drop_trailing_zeros = FALSE) %>% tab_stubhead(label =c("Capacity")) Capacity_Risk <- KEY_YEARS%>% gt(rownames_to_stub = TRUE,caption="Year") %>% data_color( fn = scales::col_numeric( palette = c(PLOT_RED, PLOT_YELLOW, PLOT_GREEN), domain = c(0, 1) ) ) %>% fmt_percent( decimals = 1, drop_trailing_zeros = FALSE) %>% tab_stubhead(label =c("Capacity"))
gtsave( data = Capacity_Risk , filename = "./Results/Primary_Simulation_Results/Upper_Bound_Results/Capacity_Table_Upper_Bound.html") gtsave( data = Capacity_Risk , filename = "./Results/Primary_Simulation_Results/Upper_Bound_Results/Capacity_Table_Upper_Bound.html")
system("wkhtmltopdf --disable-smart-shrinking --no-stop-slow-scripts --enable-local-file-access --page-width 85mm --page-height 328mm ./Results/Primary_Simulation_Results/Upper_Bound_Results/Capacity_Table_Upper_Bound.html ./Results/Primary_Simulation_Results/Upper_Bound_Results/Capacity_Table_Upper_Bound.pdf") system("wkhtmltopdf --disable-smart-shrinking --no-stop-slow-scripts --enable-local-file-access --page-width 96mm --page-height 328mm ./Results/Primary_Simulation_Results/Upper_Bound_Results/Capacity_Table_Upper_Bound.html ./Results/Primary_Simulation_Results/Upper_Bound_Results/Capacity_Table_Upper_Bound.pdf")

View File

@ -50,7 +50,7 @@ png(paste0(SAVE_RES_LOC,"Migration_Fan_Chart_Lower_Bound.png"), width = 12, heig
dev.off() dev.off()
#####Key year table #####Key year table
KEY <- RES %>% filter(Year %in% c(2029,2030,2035,2045,2055,2065)) KEY <- RES %>% filter(Year %in% c(2027,2030,2035,2045,2055,2065))
AVG_VALUES <- KEY %>% group_by(Year) %>% summarize(MED=median(Population),MEAN=mean(Population)) AVG_VALUES <- KEY %>% group_by(Year) %>% summarize(MED=median(Population),MEAN=mean(Population))
AVG_VALUES <- rbind(AVG_VALUES[,1:2]%>% rename(Value=MED) %>% mutate('Summary Stat.'="Median"),AVG_VALUES[,c(1,3)] %>% rename(Value=MEAN) %>% mutate('Summary Stat.'="Mean")) AVG_VALUES <- rbind(AVG_VALUES[,1:2]%>% rename(Value=MED) %>% mutate('Summary Stat.'="Median"),AVG_VALUES[,c(1,3)] %>% rename(Value=MEAN) %>% mutate('Summary Stat.'="Mean"))
@ -61,7 +61,7 @@ dev.off()
#rm(KEY_YEARS) #rm(KEY_YEARS)
POP_LEVELS <- seq(2000,6000,100) POP_LEVELS <- seq(2000,6000,100)
YEARS <- c(2030,2035,2045,2055,2065) YEARS <- c(2027,2030,2035,2045,2055,2065)
if(exists("KEY_YEARS")){rm(KEY_YEARS)} if(exists("KEY_YEARS")){rm(KEY_YEARS)}
for(i in YEARS ){ for(i in YEARS ){
KEY <- RES %>% filter(Year==i ) %>% pull(Population) KEY <- RES %>% filter(Year==i ) %>% pull(Population)
@ -78,5 +78,5 @@ PLOT_RED <- "red"
KEY_YEARS <- KEY_YEARS%>% as.data.frame KEY_YEARS <- KEY_YEARS%>% as.data.frame
Capacity_Risk <- KEY_YEARS%>% gt(rownames_to_stub = TRUE,caption="Year") %>% data_color( fn = scales::col_numeric( palette = c(PLOT_RED, PLOT_YELLOW, PLOT_GREEN), domain = c(0, 1) ) ) %>% fmt_percent( decimals = 1, drop_trailing_zeros = FALSE) %>% tab_stubhead(label =c("Capacity")) Capacity_Risk <- KEY_YEARS%>% gt(rownames_to_stub = TRUE,caption="Year") %>% data_color( fn = scales::col_numeric( palette = c(PLOT_RED, PLOT_YELLOW, PLOT_GREEN), domain = c(0, 1) ) ) %>% fmt_percent( decimals = 1, drop_trailing_zeros = FALSE) %>% tab_stubhead(label =c("Capacity"))
gtsave( data = Capacity_Risk , filename = "./Results/Primary_Simulation_Results/Lower_Bound_Results/Capacity_Table_Lower_Bound.html") gtsave( data = Capacity_Risk , filename = "./Results/Primary_Simulation_Results/Lower_Bound_Results/Capacity_Table_Lower_Bound.html")
system("wkhtmltopdf --disable-smart-shrinking --no-stop-slow-scripts --enable-local-file-access --page-width 89mm --page-height 328mm ./Results/Primary_Simulation_Results/Lower_Bound_Results/Capacity_Table_Lower_Bound.html ./Results/Primary_Simulation_Results/Lower_Bound_Results/Capacity_Table_Lower_Bound.pdf") system("wkhtmltopdf --disable-smart-shrinking --no-stop-slow-scripts --enable-local-file-access --page-width 101mm --page-height 331mm ./Results/Primary_Simulation_Results/Lower_Bound_Results/Capacity_Table_Lower_Bound.html ./Results/Primary_Simulation_Results/Lower_Bound_Results/Capacity_Table_Lower_Bound.pdf")