##########################
# This example only makes sense if there is a simulation
# for all countries. Below, only five countries are included,
# so the map is useless.
##########################
sim.dir <- file.path(find.package("bayesPop"), "ex-data", "Pop")
pred <- get.pop.prediction(sim.dir=sim.dir, write.to.cache=FALSE)
# Uses heat colors with seven categories by default
pop.map(pred, sex='female', age=4:10)
# Female population in child-bearing age as a proportion of totals
pop.map(pred, expression='PXXX_F[4:10] / PXXX')
# The same with more colors
params <- get.pop.map.parameters(pred, expression='PXXX_F[4:10] / PXXX')
do.call('pop.map', params)
# Another projection year on the same scale
do.call('pop.map', c(list(year=2043), params))Run the code above in your browser using DataLab