create.Lexis.matrix: Creates a Lexis surface matrix.

Description Usage Arguments Details Value Author(s) Examples

View source: R/create.Lexis.matrix.R

Description

Creates a matrix (age by year) based on data formatted in the Human Mortality Database format.

Usage

1
2
create.Lexis.matrix(HMD.dataset, Sex = "Female", minage = 50, maxage = 100,
				minyear = 1950, maxyear = 2011)

Arguments

HMD.dataset

A dataset as formatted in the Human Mortality Database, i.e. a data frame with the columns "Year", "Age", "Female", "Male", "Total"

Sex

For which sex should the matrix be created? Default setting is "Female". Other options are "Male" and "Total".

minage

HMD data cover ages 0 to 100. Please select here a value for the lower bound to be included. Default is 50.

maxage

HMD data cover ages 0 to 100. Please select here a value for the upper bound to be included. Default is 100.

minyear

Please select the first year to be included in the matrix. Default is 1950.

maxyear

Please select the last year to be included in the matrix. Default is 2011.

Details

It is expected that age is an integer.

Value

A matrix with the dimensions: length(minage:maxage) x length(minyear:maxyear) Rows represent ages, columns represent years.

Author(s)

Roland Rau

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
theyears <- 1900:2012
theages <- 0:110
n <- length(theyears) * length(theages)

# 'Simulating' a data frame in the HMD format
HMD.formatted.data <- data.frame(Year=sort(rep(theyears, length(theages))),
                                 Age = rep(theages, length(theyears)),
                                 Female = runif(n=n),
                                 Male = runif(n=n),
                                 Total = runif(n=n))

a.Lexis.matrix <- create.Lexis.matrix(HMD.dataset=HMD.formatted.data,
                                      Sex="Total", minage=30, maxage=105,
                                      minyear=1905, maxyear=2010)

ROMIplot documentation built on May 1, 2019, 8:27 p.m.