sim.dir <- file.path(find.package("bayesPop"), "ex-data", "Pop")
pred <- get.pop.prediction(sim.dir, write.to.cache=FALSE)
# observed female of Netherlands by age; 1x21x13x1 array
popFNL <- get.pop("PNL_F{}", pred, observed=TRUE)
# observed migration for all countries in the prediction object,
# here 2 countries; 2x1x13x1 array
migAll <- get.pop("GXXX", pred, observed=TRUE)
# projection population for Ecuador with 3 trajectories;
# 1x1x19x3 array
popEcu <- get.pop("P218", pred, observed=FALSE)
# the above is equivalent to
popEcu2 <- pop.trajectories(pred, "Ecuador")
# Expression "PNL_F{} / PNL_M{}" evaluated on projections
# is internally replaced by
FtoM <- get.pop("PNL_F{}", pred) / get.pop("PNL_M{}", pred)
# the example simulation was generated with 3 TFR trajectories ...
get.trajectory.indices(pred, "Netherlands", what="TFR")
# ... and 1 e0 trajectory
get.trajectory.indices(pred, "Netherlands", what="e0M")Run the code above in your browser using DataLab