mandatory_age_group: Create age group from age

View source: R/mandatory_age_group.R

mandatory_age_groupR Documentation

Create age group from age

Description

Creates age group as ordered factor according to standard ages for HCAIDCS. Values are rounded down using floor before grouping.

Usage

mandatory_age_group(x, collection = NULL)

Arguments

x

A numeric vector giving age in years, calculated by mandatory_age

collection

An optional parameter giving the collection for CDI age grouping. If the collection is not given, the bacteraemia age grouping is applied.

Value

A factor vector with levels <1 1-14 15-44 45-64 65-74 75-84 ge85 for bacteraemia or 2-14 15-44 45-64 65-74 75-84 ge85 for cdi.

See Also

mandatory_age

Examples

mandatory_age_group(0)
mandatory_age_group(x = 0)
mandatory_age_group(0, "MRSA")
mandatory_age_group(0, "cdi")
mandatory_age_group(1, "cdi")
mandatory_age_group(2, "cdi")
mandatory_age_group(0.038)
mandatory_age_group(1)
mandatory_age_group(14)
mandatory_age_group(15)
mandatory_age_group(seq(1,100, 1))
mandatory_age_group(seq(1,100, 1), "cdi")

PublicHealthEngland/hcaidcs documentation built on Jan. 19, 2024, 8:38 a.m.