pop.aggregate(pop.pred, regions,
method = c('independence', 'regional'), name = method,
inputs = list(e0F.sim.dir = NULL, e0M.sim.dir = "joint_", tfr.sim.dir = NULL),
my.location.file = NULL, verbose = FALSE)
get.pop.aggregation(sim.dir = NULL, pop.pred = NULL, name = NULL)bayesPop.prediction containing country-specific population projections.UNlocations dataset or in my.location.file (see below).UNlocations dataset, see below.pop.pred object. Alternatively, pop.pred can be used. Either sim.dir or pop.pred must be given.bayesPop.prediction containing the aggregated results. In addition it contains elements aggregation.method giving the method used, and aggregated.countries which is a list of countries aggregated for each region.UNlocations or my.location.file is used to determine countries to be aggregated, in particular the field regions argument. One can aggregate over the following location types: Type 0 means aggregating all countries of the world, type 2 is aggregating over continents, type 3 is aggregating over regions within continents, and any other integer (except 4) correponds to user-defined aggregations. Note that type 4 is reserved as a location type of countries and thus, all aggregations are performed over entries of this type. For type 2, countries are matched using the UNlocations dataset. E.g., if regions=908 (Europe) which has location type 2 in the default UNlocations dataset, all countries are aggregated for which values of 908 are found in the UNlocations table. Their identifiers correspond to the column Results of the aggregations are stored in the same top directory as the pop.pred object, in a sudirectory called aggregations_nameget.pop.aggregation. Note that multiple runs of this function with the same name will overwrite previous aggregations results of the same name.
pop.predict, tfr.predict.extra, e0.predict.extrasim.dir <- tempfile()
pred <- pop.predict(countries=c(528,218,450), output.dir=sim.dir)
aggr <- pop.aggregate(pred, 900) # aggregating World (i.e. all countries available in pred)
pop.trajectories.plot(aggr, 900, sum.over.ages=TRUE)
# countries over which we aggregated:
UNlocations[is.element(UNlocations[,'country_code'], aggr$aggregated.countries[['900']]),]
unlink(sim.dir, recursive=TRUE)Run the code above in your browser using DataLab