agegroup.create: Creates age groups using a numeric age variable

Description Usage Arguments Details Value

Description

Creates age groups using a numeric age variable

Usage

1
agegroup.create(df, age_var, ll = NULL, ul = NULL)

Arguments

df

a data.frame containing the age variable

age_var

the index of the age variable within the data.frame. It is a numeric column. The unit does not matter.

ll

an ordered vector containing the lower limit for each age group. It is a numeric vector.

ul

an ordered vector containing the upper limit for each age group. It is a numeric vector.

Details

If ll and/or ul are not provided the function uses a default age grouping containg the following groups: 0-4, 5-17, 18-44, 45-64, 65+ (65 and above).The internal upper limit for the default age grouping is 120 years. Above that treshold the age will be classified as "U" for unknown.

Value

the same data.frame to which a new "Agecat" column has been added. The class of the column is character.


hmenag1/hmUtils documentation built on May 17, 2019, 4:34 p.m.