Learn R Programming

bayesTFR (version 1.2-0)

tfr.map: TFR World Map

Description

Generates a world map of the total fertility rate for given projection period and quantile.

Usage

tfr.map(pred, quantile = 0.5, 
    projection.year = NULL, projection.index = 1, 
    device = "dev.new", main = NULL, device.args = NULL, ...)
	
tfr.map.all(pred, output.dir, output.type = "png", 
    tfr.range = NULL, nr.cats = 50, same.scale = TRUE, 
    quantile = 0.5, file.prefix='TFRwrldmap_', ...)
			
get.tfr.map.parameters(pred, tfr.range = NULL, 
    nr.cats = 50, same.scale = TRUE, quantile = 0.5, ...)

Arguments

Value

get.tfr.map.parameters returns a list with elements:predThe object of class bayesTFR.prediction used in the function.quantileValue of the argument quantile.catMethodIf the argument same.scale is TRUE, this element contains breakpoints for categorization. It is generated from a fitted gamma distribution. Otherwise, it is NULL.numCatsNumber of categories.coulourPaletteSubset of the rainbow palette, starting from dark blue and ending at red....Additional arguments passed to the function.

Rdversion

1.1

Details

tfr.map creates a single map for a given projection period and quantile. tfr.map.all generates a sequence of maps, namely one for each projection period. If the package fields is installed, a color bar legend at the botom of the map is created.

Function get.tfr.map.parameters can be used in combination with tfr.map. (Note that get.tfr.map.parameters is called from inside of tfr.map.all.) It sets breakpoints for the color scheme using quantiles of a fitted gamma distribution.

Examples

Run this code
sim.dir <- file.path(.find.package("bayesTFR"), "ex-data", 'bayesTFR.output')
pred <- get.tfr.prediction(sim.dir=sim.dir)
# Uses heat colors and seven categories by default
tfr.map(pred)
# Uses more colors with more suitable categorization
params <- get.tfr.map.parameters(pred)
do.call('tfr.map', params)
# Another projection year on the same scale
do.call('tfr.map', c(list(projection.year=2043), params))

Run the code above in your browser using DataLab