int2ageN: repeat age lower bounds once for each single age

View source: R/utilsAge.R

int2ageNR 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, as implied by AgeInt, repeat each value N times, where N is the width of the corresponding age interval. Age intervals are in this case given, and age lower bound values are calculated from AgeInt vector.

Usage

int2ageN(AgeInt, OAG)

Arguments

AgeInt

integer or numeric. Vector of age intervals.

OAG

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

Details

If OAG = TRUE then the last value is given just once, irrespective of the final value of AgeInt, otherwise the final age interval is repeated AgeInt[length(AgeInt)] times. 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

int5 <- rep(5,21)
(ageN1 <- int2ageN(int5, OAG = FALSE))
(ageN2 <- int2ageN(int5, OAG = TRUE))

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