library(tidyverse) library(scales) library(janitor) library(paletteer) source("Scripts/Load_IMPLAN.r") source("Scripts/Load_REMI.r") IMPLAN <- GET_IMPLAN_DATA() REMI <- GET_REMI_DATA() DATA <- full_join(IMPLAN,REMI) TEST <- DATA %>% group_by(Year,Region,Impact,Source) %>% mutate(value=sum(value)) %>% filter(Region=='WY') %>% ungroup ggplot(TEST ,aes(x=Year,y=value,color=Source))+geom_line()+facet_wrap(~Impact) TEST2 <- DATA %>% group_by(Year,Region,Impact,Source) %>% mutate(value=sum(value)) %>% filter(Source=='IMPLAN') %>% ungroup %>% group_by(Year,Impact) %>% summarize(DIFF=max(value)/min(value)) ggplot(TEST2 ,aes(x=Year,y=value,color=Region))+geom_line()+facet_wrap(~Impact) TEST3 <- DATA %>% group_by(Year,Region,Impact,Source) %>% mutate(value=sum(value)) %>% filter(Source=='IMPLAN') %>% ungroup %>% group_by(Year,Impact) %>% summarize(DIFF=(max(value)-min(value))/min(value)) ggplot(TEST3 ,aes(x=Year,y=DIFF))+geom_line()+facet_wrap(~Impact)