Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

poputils (version 0.4.1)

age_group_type: Infer Age Label Type

Description

Determine whether a set of age labels refer to one-year, five-year, or life-table age groups.

Usage

age_group_type(x)

Value

"single", "five", or "lt".

Arguments

x

A vector of age labels

Details

The valid types of age labels are:

  • "single". One-year age groups, eg "0" or "55", and possibly an open age group, eg "90+".

  • "five". Five-year age groups, eg "0-4" or "55-59", and possibly an open age group, eg "100+".

  • "lt". Life table age groups, eg "0", "1-4", "5-9", "55-59", or "80+".

If x does not fit any of these descriptions, then age_group_type() throws an error.

If x could belong to more than one type, then age_group_type() prefers "single" to "five" and "lt", and prefers "five" to "lt".

Examples

Run this code
age_group_type(c("5-9", "0-4", "100+"))
age_group_type(c("2", "5", "1"))
age_group_type(c("0", "1-4"))

## could be any "single" or "lt"
age_group_type("0")

## could be "five" or "lt"
age_group_type("80-84")

Run the code above in your browser using DataLab