Updating data
This commit is contained in:
parent
6e17ae0ae8
commit
2a666eefda
@ -1,8 +1,22 @@
|
|||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
GET_FILE <- function(YEAR){
|
GET_DATA <- function(){
|
||||||
read_csv(paste0("Model_Outputs/IMPLAN/US/US_",YEAR,"/economic_indicators_by_impact.csv")) %>% mutate(year=YEAR) %>% filter(!is.na(Impact))
|
GET_FILE_US <- function(YEAR){read_csv(paste0("Model_Outputs/IMPLAN/US/US_",YEAR,"/economic_indicators_by_impact.csv")) %>% mutate(year=YEAR) %>% filter(!is.na(Impact))%>% mutate(Region="US") }
|
||||||
}
|
GET_FILE_WY <- function(YEAR){read_csv(paste0("Model_Outputs/IMPLAN/Wyoming/WY_",YEAR,"/economic_indicators_by_impact.csv")) %>% mutate(year=YEAR) %>% filter(!is.na(Impact))%>% mutate(Region="WY") }
|
||||||
DATA <- lapply(2028:2035,GET_FILE) %>% bind_rows()%>% rename(Income=`Labor Income`) %>% mutate(Income=parse_number(Income),`Value Added`=parse_number(`Value Added`),Output=parse_number(Output))
|
DATA <-rbind(lapply(2028:2035,GET_FILE_US) %>% bind_rows()%>% rename(Income=`Labor Income`) %>% mutate(Income=parse_number(Income),`Value Added`=parse_number(`Value Added`),Output=parse_number(Output)) ,
|
||||||
DATA
|
lapply(2028:2035,GET_FILE_WY) %>% bind_rows()%>% rename(Income=`Labor Income`) %>% mutate(Income=parse_number(Income),`Value Added`=parse_number(`Value Added`),Output=parse_number(Output)))
|
||||||
DATA$Impact <- gsub("3 - ","",gsub("2 - ","",gsub("1 - ","",DATA$Impact)))
|
|
||||||
|
DATA$Impact <- gsub("3 - ","",gsub("2 - ","",gsub("1 - ","",DATA$Impact)))
|
||||||
|
DATA <- DATA %>% pivot_longer(-c(Impact,year,Region)) %>% rename(Type=Impact,Impact=name)
|
||||||
|
DATA$Impact <- gsub("3 - ","",gsub("2 - ","",gsub("1 - ","",DATA$Impact)))
|
||||||
|
return(DATA)
|
||||||
|
}
|
||||||
|
|
||||||
|
DATA <- GET_DATA()
|
||||||
|
EMP_WY <- DATA %>% filter(Impact=="Employment",Region=="WY")
|
||||||
|
DOL_WY <- DATA %>% filter(Impact!="Employment",Region=="WY")
|
||||||
|
|
||||||
|
ggplot(EMP_WY, aes(x = year, y = value, fill = Type)) + geom_bar(stat = "identity", position = "stack") + theme_minimal()
|
||||||
|
ggplot(DOL_WY, aes(x = year, y = value/10^9, fill = Type)) + geom_bar(stat = "identity", position = "stack") + theme_minimal()+facet_wrap(~Impact)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user