mandatory_age: Calculate patient age in manner that conforms to mandatory...

View source: R/mandatory_age.R

mandatory_ageR Documentation

Calculate patient age in manner that conforms to mandatory surveillance requirements

Description

Calculates age as integer based on number of years lived. Takes into account leap years.

Usage

mandatory_age(date_of_birth, specimen_date)

Arguments

date_of_birth

Patient's date of birth in date format

specimen_date

Date of specimen in date format

Value

Vector of integer ages

Examples

library(lubridate)
dob <- dmy("31/01/2000")
spec <- dmy("21/01/2001")
mandatory_age(dob, spec)
# Counter example :
round(as.numeric(spec-dob)/365.25, 1)

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