This work uses the age and sex structure unconstrained data (https://hub.worldpop.org/geodata/listing?id=30) for India from Worldpop.org (summary note : https://docs.google.com/document/d/1VVjMFbYM0RsmxRDEfZsbHHOJeqBjkTu1SSpoinmWk1Q/edit#heading=h.w4e1uk1k1taa). The data from world pop is cropped to state boundary.
For the work, we have to load the following libraries:
packages <- c("terra")
A for-loop extracts the geotifs of specific year. For each year, the populations of belonging to age groups less than 5 years are added up to get a yearly single image representing the Young population. Finally, the images are saved separately for each year.
year <- 2015:2020
for(i in year){
#i <- 2015
s_files <- dir("state/agesexstructure")
split <- strsplit(s_files,"_")
#matching for the year
state_1 <- match(unlist(split), sprintf("%s.tif",i))
pos <- which(!is.na(state_1))
pos <- round(pos/4,0)
s_files <- s_files[pos]
#matching for the age
split <- strsplit(s_files,"_")
state_1 <- match(unlist(split), "0")
pos_1 <- which(!is.na(state_1))
pos_1 <- round(pos_1/4,0)
state_2 <- match(unlist(split), "5")
pos_2 <- which(!is.na(state_2))
pos_2 <- round(pos_2/4,0)
s_files <- c(s_files[pos_1],s_files[pos_2])
file_path <- "state/agesexstructure"
pop <- rast(sprintf("%s/%s",file_path,s_files))
pop_yr <- app(pop, "sum")
plot(pop_yr)
writeRaster(pop_yr,sprintf("outputs_vulnerability/State_youngpop_%s.tif",i), overwrite = T)
}
The average growth rate of the Young Population is calculated using the Young Population of 2015 and 2021. The growth rate is used to project the Young Population ratio from 2020 for 2021 and 2022.
#projecting the aged population for years 2021 and 2021 using the growth rate of aged population between 2015 and 2020
#projected population for 2021
fact2015 <- rast("outputs_vulnerability/State_youngpop_2015.tif")
fact2020 <- rast("outputs_vulnerability/State_youngpop_2020.tif")
factGrowthRate <- ((fact2020 - fact2015)/fact2015)/5
fact2021 <- fact2020 + fact2020*factGrowthRate
plot(fact2021, main = "Projected young population 2021")
writeRaster(fact2021 , "state/State_youngpop_2021.tif", overwrite=TRUE)
#projected population for 2022
fact2022 <- fact2021 + fact2021*factGrowthRate
plot(fact2022, main = "Projected young population 2022")
writeRaster(fact2022 , "state/State_youngpop_2022.tif", overwrite=TRUE)