age2int: Infer age class intervals from lower age bounds.

View source: R/utilsAge.R

age2intR Documentation

Infer age class intervals from lower age bounds.

Description

Determine age class intervals based on a vector of age class lower bounds.

Usage

age2int(Age, OAG = TRUE, OAvalue = NA)

Arguments

Age

integer or numeric. Vector of lower age group bounds .

OAG

logical. Whether or not the final age group is open. Default TRUE.

OAvalue

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

Details

If the final age group is open, it is given a value of NA by default, or else a user-determined value. If the final age group is closed, it is assumed to be equal to the next-lower interval. If the final age interval is known and not equal to the next lowest interval, specify OAG = TRUE and assign its value to OAvalue.

Value

Age interval vector, of same length as Age.

Examples

# single age examples:
Age  <- 0:100
age2int(Age, OAG = TRUE, OAvalue = NA)
age2int(Age, OAG = TRUE, OAvalue = Inf)
age2int(Age, OAG = FALSE)

# and for abridged ages:
AgeA <- c(0,1,seq(5,85,by=5))
age2int(AgeA, OAG = TRUE, OAvalue = NA)
age2int(AgeA, OAG = TRUE, OAvalue = Inf)
age2int(AgeA, OAG = FALSE)

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