age2ageN: repeat age lower bounds once for each single age

View source: R/utilsAge.R

age2ageNR Documentation

repeat age lower bounds once for each single age

Description

This is a frequent grouping situation. For a given vector of lower age bounds, repeat each value N times, where N is the width of the corresponding age interval. Age intervals are in this case calculated from the original Age vector.

Usage

age2ageN(Age, AgeInt = NULL, OAG = FALSE)

Arguments

Age

integer. Vector of lower age bounds.

AgeInt

integer vector of age group widths.

OAG

logical. Whether or not the final age group open. Default FALSE. See details

Details

If OAG = TRUE then the last value is not repeated, otherwise the final age interval is assumed to be the same width as the penultimate. Here intervals do not need to be of uniform width.

Value

integer vector of elements of Age repeated once for each implied single age.

Examples

age1 <- seq(0,100,by=5)
(ageN1 <- age2ageN(age1, OAG = FALSE))
(ageN2 <- age2ageN(age1, OAG = TRUE))

timriffe/DemoTools documentation built on Jan. 28, 2024, 5:13 a.m.