agegrp_name: Generate names for age-group bands

View source: R/misc_functions.R

agegrp_nameR Documentation

Generate names for age-group bands

Description

'agegrp_name' generates names for age-group bands given lower and upper age limits, and band width

Usage

agegrp_name(
  min_age = 0L,
  max_age = 85L,
  grp_width = 5L,
  grp_lessthan_1 = TRUE,
  match_input = FALSE,
  match_input_max_age = max_age
)

Arguments

min_age

A non-negative integer. The lower age limit for which names will be generated.

max_age

A non-negative integer. The upper age limit for which names will be generated.

grp_width

A positive integer. The band width of the age-groups.

grp_lessthan_1

A logical scalar. if TRUE and min_age == 0, then the first age-group name is "<1".

match_input

A logical scalar. If TRUE, then the names are repeated to match every single year of age between min_age and match_input_max_age.

match_input_max_age

a non-negative integer. See above.

Value

A character vector of with the names for the age-groups.

Examples

agegrp_name(20, 79, 5)
agegrp_name(20, 80, 5)
agegrp_name(0, 80, 10, TRUE)
agegrp_name(20, 30, 5, FALSE, TRUE)
agegrp_name(20, 30, 5, FALSE, TRUE)
agegrp_name(20, 30, 5, FALSE, TRUE, 32)

ChristK/CKutils documentation built on April 11, 2025, 10:11 p.m.