Skip to contents

Recode age type of cause-of-death data based on CoDEdit rules

Usage

cod_recode_age_type(age_type, age_type_code = c("D", "M", "Y"))

Arguments

age_type

A vector of values for age type based on the CoDEdit rules. This should either be "D" for age in days, "M" for age in months, or "Y" for age in years. If values are different from these, then age_type_code should be specified to correspond to the day, month, and year values of age_type.

age_type_code

A character or integer vector of 3 values that indicate which values are to be considered pertaining to days (first value in the vector), to months (second value in the vector), or years (third value in the vector).

Value

A character value or vector of values containing either "D", "M", or "Y" for days, months, or years respectively.

Examples

cod_recode_age_type(
  age_type = c(rep("d", 3), rep("m", 2), rep("y", 3)),
  age_type_code = c("d", "m", "y")
)
#> [1] "D" "D" "D" "M" "M" "Y" "Y" "Y"