inferAgeIntAbr: Infer abridged age groups widths.

View source: R/utilsAge.R

inferAgeIntAbrR Documentation

Infer abridged age groups widths.

Description

This function is an auxiliary used by top level functions where it is guaranteed that age groups are standard abridged age groups. If Age is specified, this will work as well for other age groupings.

Usage

inferAgeIntAbr(Age, vec, OAG = FALSE, OAvalue = NA)

Arguments

Age

integer. Vector of lower bound of each age group.

vec

Any vector, presumably a count, rate, or similar.

OAG

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

OAvalue

numeric or integer. The value to use for the final age interval if OAG = TRUE. Default NA.

Details

If based solely on the length of a vector, this will give erroneous results if ages are anything other than standard abridged ages groups. If the final age group is open, the interval width is defined as NA. Inf or -1 would have also been a good choice, but we went with NA.

Value

An integer vector of length(vec) indicating the width of the abridged age group that each vector element corresponds to.

Examples

vec <- runif(20)
inferAgeIntAbr(vec = vec)
inferAgeIntAbr(vec = vec, OAG = TRUE)
inferAgeIntAbr(Age = 0:100, OAG = TRUE)

timriffe/DemoTools documentation built on Oct. 14, 2024, 12:53 p.m.