library(rgcam)
setwd("C:/Users/guti220/Desktop/int-ver-local/project-files")
proj <- loadProject("land.dat")
df <- proj$GCAM44_SSP1$`Land Allocation`
la <- unique(df$`land-allocation`)
expand.allocation <- function(la) {
la.splt <- la %>%
str_replace_all("biomass_grass", "biomass") %>%
str_replace_all("biomass_tree", "biomass") %>%
str_replace_all("Root_Tuber", "RootTuber") %>%
str_split("_", simplify=TRUE)
la.splt[,1] <- la.splt[,1] %>%
str_replace_all("biomass-Grass", "biomass") %>%
str_replace_all("RootTuber", "Root_Tuber")
la.splt
}
la.splt <- expand.allocation(la)
la.df <- data.frame(landallocation = la, crop = la.splt[,1], basin = la.splt[,2], irr = la.splt[,3], tech = la.splt[,4]) %>%
mutate_all(as.character)
write.csv(la.df, "allocation-map.csv", row.names=F)
# inspect crops -----------------------------------------------------------
area <- proj$GCAM44_SSP1$`Land Allocation` %>%
transf[["Land Allocation"]]()
area <- sort(unique(area$crop)) %>% as.character()
crop <- proj$GCAM44_SSP1$`Ag Production by Crop Type` %>%
transf[["Ag Production by Crop Type"]]()
crop <- sort(unique(crop$output))
area.notcrop <- area[! area %in% crop]
crop.notarea <- crop[! crop %in% area]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.