Chnaged all dates to start in 2029
This commit is contained in:
parent
32ae8c79d3
commit
b32be3c23c
33
Visuals.r
33
Visuals.r
@ -10,13 +10,13 @@ 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(Year=parse_number(Year))
|
EMPLOY <- read_csv(paste0(DATA_DIR,"Direct, Indirect, and Induced -Employment.csv" ),skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(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[EMPLOY_NUM$Year==2028,]$Year <-2029
|
||||||
|
|
||||||
|
#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")))
|
||||||
EMPLOY_NUM %>% filter(Employment=='Direct')
|
#EMPLOY_NUM %>% filter(Category=='Total',Employment!=0)%>% mutate(Period=ifelse(Year>2033,"Operating","Construction")) %>% group_by(Period) %>% summarize(Employment=mean(Employment))
|
||||||
EMPLOY_NUM
|
|
||||||
EMPLOY_NUM %>% filter(Category=='Total',Employment!=0)%>% mutate(Period=ifelse(Year>2033,"Operating","Construction")) %>% group_by(Period) %>% summarize(Employment=mean(Employment))
|
|
||||||
EMPLOY_NUM %>% filter(Category=='Total')%>% mutate(Period=ifelse(Year>2033,"Operating","Construction")) %>% group_by(Period) %>% summarize(Employment=mean(Employment))
|
EMPLOY_NUM %>% filter(Category=='Total')%>% mutate(Period=ifelse(Year>2033,"Operating","Construction")) %>% group_by(Period) %>% summarize(Employment=mean(Employment))
|
||||||
EMPLOY_NUM %>% filter(Category=='Total') %>% print(n=100)
|
EMPLOY_NUM %>% filter(Category=='Total') %>% print(n=100)
|
||||||
|
|
||||||
@ -25,20 +25,21 @@ COLORS <- rev(paletteer_d("fishualize::Alosa_fallax",n=4,direction=1)[-2])
|
|||||||
MAX_VAL <- round(max(EMPLOY_NUM$Employment))
|
MAX_VAL <- round(max(EMPLOY_NUM$Employment))
|
||||||
MAX_VAL
|
MAX_VAL
|
||||||
COOL_DOWN <- as.numeric(EMPLOY_NUM[5,3])
|
COOL_DOWN <- as.numeric(EMPLOY_NUM[5,3])
|
||||||
|
COOL_DOWN
|
||||||
#EMPLOY_NUM
|
#EMPLOY_NUM
|
||||||
#EMPLOY_NUM %>% filter(Category=='Total') %>% arrange(Year)%>% print(n=100)
|
#EMPLOY_NUM %>% filter(Category=='Total') %>% arrange(Year)%>% print(n=100)
|
||||||
df <- data.frame(Year=c(2032.5,2034.25,2040.25,2059.75),Employment=c(MAX_VAL+125,COOL_DOWN,687+20,596+20),text=c("Peak of 2,521","Stabalized at 878" ,"687 in 2040","Ends at 596"))
|
df <- data.frame(Year=c(2032.5,2034.25,2040.25,2059.75),Employment=c(MAX_VAL+125,900,687+20,596+20),text=c("Peak of 2,521","Stabilized at 878" ,"687 in 2040","Ends at 596"))
|
||||||
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(2029,seq(2035,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=EMPLOY_NUM %>% filter(Category=="Total"),linewidth=1)+geom_text(data=df,aes(label = text),size=6, vjust = "inward", hjust = "inward")+theme(text = element_text(size = 20),legend.position = "top")+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=250))
|
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(2029,seq(2035,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=EMPLOY_NUM %>% filter(Category=="Total"),linewidth=1)+geom_text(data=df,aes(label = text),size=6, vjust = "inward", hjust = "inward")+theme(text = element_text(size = 20),legend.position = "top")+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=250))
|
||||||
|
JOB_PLOT
|
||||||
png(paste0(OUTPUT_DIR,"Job_plot.png" ) , units = "in", width = 11, height = 8, res = 600)
|
png(paste0(OUTPUT_DIR,"Job_plot.png" ) , units = "in", width = 11, height = 8, res = 600)
|
||||||
JOB_PLOT
|
JOB_PLOT
|
||||||
dev.off()
|
dev.off()
|
||||||
#JOB_PLOT
|
#JOB_PLOT
|
||||||
###################Output graph
|
###################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(Year=parse_number(Year))
|
OUTPUT <- read_csv(paste0(DATA_DIR,"Direct, Indirect, and Induced -Output.csv" ),skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(Year=parse_number(Year))
|
||||||
OUTPUT_NUM <- OUTPUT %>% select(-Units,Output=value) %>% filter(Year>=2028) %>% mutate(Output=Output*1000)
|
OUTPUT_NUM <- OUTPUT %>% 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))
|
||||||
OUTPUT_NUM$Category <- gsub(" Output","",OUTPUT_NUM$Category)
|
OUTPUT_NUM$Category <- gsub(" Output","",OUTPUT_NUM$Category)
|
||||||
OUTPUT_NUM$Category <- factor(OUTPUT_NUM$Category,levels=rev(c("Direct","Indirect","Induced","Total")))
|
OUTPUT_NUM$Category <- factor(OUTPUT_NUM$Category,levels=rev(c("Direct","Indirect","Induced","Total")))
|
||||||
|
|
||||||
@ -92,14 +93,11 @@ INDUSTRY_JOBS$Industry <- ifelse(INDUSTRY_JOBS$Industry=='Ambulatory health care
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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) %>% ungroup
|
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) %>% ungroup
|
||||||
#INDUSTRY_JOBS %>% pull(Industry) %>% unique
|
#INDUSTRY_JOBS %>% pull(Industry) %>% unique
|
||||||
|
|
||||||
ORDER <- c(INDUSTRY_JOBS %>% filter(Industry!='Other') %>% group_by(Industry) %>% summarize(MEAN=mean(Jobs)) %>% arrange(desc(MEAN)) %>% pull(Industry) %>% unique,"Other")
|
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)
|
INDUSTRY_JOBS$Industry <- factor(INDUSTRY_JOBS$Industry,levels=ORDER)
|
||||||
INDUSTRY_JOBS
|
|
||||||
|
|
||||||
JOB_TYPE_PLOT <- ggplot(INDUSTRY_JOBS ,aes(x=Year,y=Jobs,fill=Industry))+geom_bar(stat='identity')+ paletteer::scale_fill_paletteer_d("colorBlindness::Blue2DarkRed18Steps",name="")+theme_bw()+theme(text = element_text(size = 20),legend.position = "top")+guides(fill=guide_legend(nrow=4,byrow=TRUE)) +scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=500))
|
JOB_TYPE_PLOT <- ggplot(INDUSTRY_JOBS ,aes(x=Year,y=Jobs,fill=Industry))+geom_bar(stat='identity')+ paletteer::scale_fill_paletteer_d("colorBlindness::Blue2DarkRed18Steps",name="")+theme_bw()+theme(text = element_text(size = 20),legend.position = "top")+guides(fill=guide_legend(nrow=4,byrow=TRUE)) +scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=500))
|
||||||
png(paste0(OUTPUT_DIR,"Job_Dist_Plot.png"), units = "in", width = 11, height = 8, res = 600)
|
png(paste0(OUTPUT_DIR,"Job_Dist_Plot.png"), units = "in", width = 11, height = 8, res = 600)
|
||||||
@ -127,12 +125,10 @@ dev.off()
|
|||||||
PERSONAL_INCOME <- read_csv(paste0(DATA_DIR,'Personal Income - By Region - Personal Income by Region.csv'),skip=5)%>% select(-Units) %>% pivot_longer(c(-Region),names_to="Year") %>% mutate(value=value*1000,Year=parse_number(Year)) %>% filter(Year>=2029) %>% rename(Income=value)
|
PERSONAL_INCOME <- read_csv(paste0(DATA_DIR,'Personal Income - By Region - Personal Income by Region.csv'),skip=5)%>% select(-Units) %>% pivot_longer(c(-Region),names_to="Year") %>% mutate(value=value*1000,Year=parse_number(Year)) %>% filter(Year>=2029) %>% rename(Income=value)
|
||||||
|
|
||||||
TOTAL_PERSONAL_INCOME <- PERSONAL_INCOME %>% filter(Region=='All Regions') %>% select(-Region)
|
TOTAL_PERSONAL_INCOME <- PERSONAL_INCOME %>% filter(Region=='All Regions') %>% select(-Region)
|
||||||
TOTAL_PERSONAL_INCOME
|
|
||||||
|
|
||||||
TAXES <- read_csv("Results/Tax_PI/Revenues.csv",skip=5) %>% clean_names() %>% filter(!is.na(revenue))
|
TAXES <- read_csv("Results/Tax_PI/Revenues.csv",skip=5) %>% clean_names() %>% filter(!is.na(revenue))
|
||||||
colnames(TAXES) <- gsub("fy","",colnames(TAXES))
|
colnames(TAXES) <- gsub("fy","",colnames(TAXES))
|
||||||
TAXES <- TAXES %>% pivot_longer(c(-revenue,-units),names_to='year',values_to='Taxes') %>% mutate(Taxes=Taxes*1000) %>% select(-units)
|
TAXES <- TAXES %>% pivot_longer(c(-revenue,-units),names_to='year',values_to='Taxes') %>% mutate(Taxes=Taxes*1000) %>% select(-units)
|
||||||
TAXES
|
|
||||||
TAXES$revenue <- gsub('State Sales & Use Taxes - ','Sales Tax: ', TAXES$revenue)
|
TAXES$revenue <- gsub('State Sales & Use Taxes - ','Sales Tax: ', TAXES$revenue)
|
||||||
TAXES <- TAXES %>% filter(year>2028,!is.na(revenue))
|
TAXES <- TAXES %>% filter(year>2028,!is.na(revenue))
|
||||||
TAXES <- TAXES %>% filter(Taxes>0)
|
TAXES <- TAXES %>% filter(Taxes>0)
|
||||||
@ -140,12 +136,6 @@ TAXES$revenue[!grepl("Sales",TAXES$revenue)] <- 'Other Taxes'
|
|||||||
TAXES <- TAXES %>% rename(Revenue='Taxes','Tax'=revenue,'Year'=year) %>% select(Year,Tax,Revenue)
|
TAXES <- TAXES %>% rename(Revenue='Taxes','Tax'=revenue,'Year'=year) %>% select(Year,Tax,Revenue)
|
||||||
TAXES <- TAXES %>% group_by(Year,Tax) %>% summarize(Revenue=sum(Revenue))
|
TAXES <- TAXES %>% group_by(Year,Tax) %>% summarize(Revenue=sum(Revenue))
|
||||||
TOTAL_TAXES <- TAXES %>% group_by(Year) %>% summarize('Million (USD)'=sum(Revenue)/10^6,Metric='Wyoming Taxes') %>% mutate(Year=as.numeric(Year))
|
TOTAL_TAXES <- TAXES %>% group_by(Year) %>% summarize('Million (USD)'=sum(Revenue)/10^6,Metric='Wyoming Taxes') %>% mutate(Year=as.numeric(Year))
|
||||||
TOTAL_TAXES
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DOLLAR_VALUES <- rbind(OUTPUT_NUM %>% filter(Category=='Total') %>% select(-Category) %>% mutate(Metric='Economic Output') %>% rename('Million (USD)'=Output),
|
DOLLAR_VALUES <- rbind(OUTPUT_NUM %>% filter(Category=='Total') %>% select(-Category) %>% mutate(Metric='Economic Output') %>% rename('Million (USD)'=Output),
|
||||||
@ -153,24 +143,19 @@ GDP_TOTAL %>% mutate(Metric='GDP') %>% rename('Million (USD)'=GDP),
|
|||||||
TOTAL_TAXES,
|
TOTAL_TAXES,
|
||||||
TOTAL_PERSONAL_INCOME %>% mutate(Metric='Wages Paid') %>% rename('Million (USD)'=Income))
|
TOTAL_PERSONAL_INCOME %>% mutate(Metric='Wages Paid') %>% rename('Million (USD)'=Income))
|
||||||
FACET_INDICATORS_PLOT <- ggplot(DOLLAR_VALUES, aes(x=Year,y=`Million (USD)`,fill=Metric))+geom_area()+facet_wrap(.~Metric,nrow=2)+theme_bw()+scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=50))+theme(legend.position = "top",text=element_text(size=20))+scale_fill_manual(values=paletteer::paletteer_d("calecopal::lupinus") )
|
FACET_INDICATORS_PLOT <- ggplot(DOLLAR_VALUES, aes(x=Year,y=`Million (USD)`,fill=Metric))+geom_area()+facet_wrap(.~Metric,nrow=2)+theme_bw()+scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=50))+theme(legend.position = "top",text=element_text(size=20))+scale_fill_manual(values=paletteer::paletteer_d("calecopal::lupinus") )
|
||||||
DOLLAR_VALUES
|
|
||||||
|
|
||||||
DIRECT_TAX <- c(10.408,22.355,24.647,58.221,55.835,53.449,51.062,48.676,46.290,43.904,41.518,39.132,37.318,35.766,34.214,32.662,31.110,29.557,28.005,26.453,24.901,23.349,21.797,20.244,18.692,17.140,15.588,14.036,12.484,10.931,9.379)
|
DIRECT_TAX <- c(10.408,22.355,24.647,58.221,55.835,53.449,51.062,48.676,46.290,43.904,41.518,39.132,37.318,35.766,34.214,32.662,31.110,29.557,28.005,26.453,24.901,23.349,21.797,20.244,18.692,17.140,15.588,14.036,12.484,10.931,9.379)
|
||||||
DIRECT_TAX <- cbind(2030:2060,DIRECT_TAX ) %>% as_tibble
|
DIRECT_TAX <- cbind(2030:2060,DIRECT_TAX ) %>% as_tibble
|
||||||
|
|
||||||
colnames(DIRECT_TAX) <- c("Year","Tax")
|
colnames(DIRECT_TAX) <- c("Year","Tax")
|
||||||
DOLLAR_VALUES
|
|
||||||
DOLLAR_VALUES[DOLLAR_VALUES$Metric=='Wyoming Taxes','Million (USD)'] <- DOLLAR_VALUES[DOLLAR_VALUES$Metric=='Wyoming Taxes','Million (USD)'] + c(0,DIRECT_TAX$Tax)
|
DOLLAR_VALUES[DOLLAR_VALUES$Metric=='Wyoming Taxes','Million (USD)'] <- DOLLAR_VALUES[DOLLAR_VALUES$Metric=='Wyoming Taxes','Million (USD)'] + c(0,DIRECT_TAX$Tax)
|
||||||
|
|
||||||
TAX_PLOT <- ggplot(DOLLAR_VALUES %>% filter(Metric %in% c('Wyoming Taxes')), aes(x=Year,y=`Million (USD)`,fill=Metric))+geom_area()+theme_bw()+scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=5))+scale_fill_manual(values=paletteer::paletteer_d("calecopal::lupinus")[4],name="" )+theme(legend.position = "top",text=element_text(size=20))+ guides(fill = "none")
|
TAX_PLOT <- ggplot(DOLLAR_VALUES %>% filter(Metric %in% c('Wyoming Taxes')), aes(x=Year,y=`Million (USD)`,fill=Metric))+geom_area()+theme_bw()+scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=5))+scale_fill_manual(values=paletteer::paletteer_d("calecopal::lupinus")[4],name="" )+theme(legend.position = "top",text=element_text(size=20))+ guides(fill = "none")
|
||||||
TAX_PLOT
|
|
||||||
|
|
||||||
png(paste0(OUTPUT_DIR,"Total_Tax_Plot.png"), units = "in", width = 11, height = 8, res = 600)
|
png(paste0(OUTPUT_DIR,"Total_Tax_Plot.png"), units = "in", width = 11, height = 8, res = 600)
|
||||||
TAX_PLOT
|
TAX_PLOT
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
||||||
FACET_INDICATORS_PLOT <- ggplot(DOLLAR_VALUES , aes(x=Year,y=`Million (USD)`,fill=Metric))+geom_area()+facet_wrap(.~Metric,nrow=2)+theme_bw()+scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=50))+scale_fill_manual(values=paletteer::paletteer_d("calecopal::lupinus") )+theme(legend.position = "top",text=element_text(size=20))
|
FACET_INDICATORS_PLOT <- ggplot(DOLLAR_VALUES , aes(x=Year,y=`Million (USD)`,fill=Metric))+geom_area()+facet_wrap(.~Metric,nrow=2)+theme_bw()+scale_x_continuous(breaks=c(2029,seq(2035,2060,by=5)))+scale_y_continuous(labels = scales::comma,breaks=seq(0,3000,by=50))+scale_fill_manual(values=paletteer::paletteer_d("calecopal::lupinus") )+theme(legend.position = "top",text=element_text(size=20))
|
||||||
FACET_INDICATORS_PLOT
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user