Learn R Programming

LexisPlotR (version 0.4.0)

lexis.hmd: Deprecated. Fill Lexis triangles by HMD data

Description

The function opens an existing Lexis grid and fill the triangles according to data from the Human Mortality Database.

Usage

lexis.hmd(lg, hmd.data, column)

Arguments

lg,

an existing object originally created with lexis.grid().

hmd.data,

a data.frame created with prepare.hmd().

column

character, the name of the column of hmd.data the triangles shall be filled with.

Details

The function creates a subset of hmd.data that fits in the dimensions of the existing Lexis grid. The triangles will be filled according to the data in column.

Examples

Run this code
# NOT RUN {
library(LexisPlotR)
lg <- lexis.grid(year.start = 1980, year.end = 1985, age.start = 0, age.end = 5)
# Load sample data
path <- system.file("extdata", "Deaths_lexis_sample.txt", package = "LexisPlotR")
deaths.triangles <- prepare.hmd(path)
lexis.hmd(lg = lg, hmd.data = deaths.triangles, column = "Total")

### Plot data not explicitly present in HMD data
deaths.triangles$RatioMale <- deaths.triangles$Male / deaths.triangles$Total
lexis.hmd(lg, deaths.triangles, "RatioMale")
# }

Run the code above in your browser using DataLab