e0.map {bayesLife} | R Documentation |
World Map of the Life Expectancy
Description
Generates a world map of the life expectancy for given quantile and projection or estimation period, using different techniques: e0.map
and e0.map.all
use rworldmap, e0.ggmap
uses ggplot2, and e0.map.gvis
creates an interactive map via GoogleVis.
Usage
e0.map(pred, ...)
e0.ggmap(pred, ...)
e0.map.all(pred, output.dir, output.type = "png",
e0.range = NULL, nr.cats = 50, same.scale = TRUE,
quantile = 0.5, file.prefix = "e0wrldmap_", ...)
get.e0.map.parameters(pred, e0.range = NULL,
nr.cats = 50, same.scale = TRUE, quantile = 0.5, ...)
e0.map.gvis(pred, ...)
Arguments
pred |
Object of class |
output.dir |
Directory into which resulting maps are stored. |
output.type |
Type of the resulting files. It can be “png”, “pdf”, “jpeg”, “bmp”, “tiff”, or “postscript”. |
e0.range |
Range of the life expectancy to be displayed. It is of the form |
nr.cats |
Number of color categories. |
same.scale |
Logical controlling if maps for all years of this prediction object should be on the same color scale. |
quantile |
Quantile for which the map should be generated. It must be equal to one of the values in |
file.prefix |
Prefix for file names. |
... |
In |
Details
e0.map
creates a single map for the given time period and quantile. e0.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.e0.map.parameters
can be used in combination with e0.map
. (Note that get.e0.map.parameters
is called from inside of e0.map.all
.) It sets breakpoints for the color scheme using quantiles of a fitted gamma distribution.
Function e0.ggmap
is similar to e0.map
, but used the ggplot2 package in combination with the geom_sf
function.
Function e0.map.gvis
creates an interactive map using the googleVis package and opens it in an internet browser. It also generates a table of the mapped values that can be sorted by columns interactively in the browser.
By default, both e0.map
, e0.ggmap
and e0.map.gvis
produce maps of life expectancy. Alternatively, the functions can be used to plot country-specific MCMC parameters into a world map. They are given by the argument par.name
. One can pass any value from e0.parameter.names.cs.extended()
.
Value
get.e0.map.parameters
returns a list with elements:
pred |
The object of class |
quantile |
Value of the argument |
catMethod |
If the argument |
numCats |
Number of categories. |
coulourPalette |
Subset of the rainbow palette, starting from dark blue and ending at red. |
... |
Additional arguments passed to the function. |
Author(s)
Hana Sevcikova, Adrian Raftery
See Also
Examples
## Not run:
sim.dir <- file.path(find.package("bayesLife"), "ex-data", "bayesLife.output")
pred <- get.e0.prediction(sim.dir = sim.dir)
# Using ggplot2
e0.ggmap(pred, same.scale = TRUE)
e0.ggmap(pred, year = 2100, same.scale = TRUE)
# Using rworldmap
# Uses heat colors and seven categories by default
e0.map(pred)
# Uses more colors with more suitable categorization
params <- get.e0.map.parameters(pred)
do.call('e0.map', params)
# Another projection year on the same scale
do.call('e0.map', c(list(year = 2043), params))
# Interactive map (requires Flash)
e0.map.gvis(pred, year = 2043)
## End(Not run)