is_age_redundant: check for redundant age specification

View source: R/utilsAge.R

is_age_redundantR Documentation

check for redundant age specification

Description

Ages are considered redundant if values for the underlying single ages are repeated. This might occur if there is an extra open age group below the final open age group. For example we have single ages 0 to 84, with an open age group of 85+, but the data also contain an open age group of 70+, leading to age 70 appearing twice. This will also detect

Usage

is_age_redundant(Age, AgeInt)

Arguments

Age

integer vector of single ages (lower bound)

AgeInt

integer vector. Age interval widths

Details

Missing AgeInt are conservatively imputed with 20, which will most often trigger FALSE and thereby flag for further inspection.

Value

logical. Are there repeated values in the Age vector?

Examples

Age    <- c(0:100,70)
AgeInt <- c(rep(1,100),NA,NA)
# it doesn't matter if Age is sequential for this check
is_age_redundant(Age, AgeInt)

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