age_character: Age conversion: from numeric to character

View source: R/aging.R

age_characterR Documentation

Age conversion: from numeric to character

Description

Converts numeric ages into strings expressing the completed years, months and days.

Usage

age_character(x, units = c("years", "months"), depth =c("days", "months", "years"),
    origin.units = c("years","months"), origin.depth = c("days", "months", "years"),
    use.leap = TRUE)

Arguments

x

Numeric vector of ages.

units

Character specifying the units of the age in output (years or months).

depth

Character specifying the depth of the age in output (days, months or years).

origin.units

Character specifying the units of the age in input (years or months).

origin.depth

Character specifying the depth of the age in input (days, months or years).

use.leap

Logical specifying if consider or ignore leap years.

Details

The function accepts inputs in which the integer part represents the elapsed units of ages (years or months) and the decimal part represents the elapsed portion of elapsed days or months from the last unit, depending on the depth level.

Value

The age completed by the subject.

See Also

age_completed, age_numeric, age_segment

Examples

born <- c("2008-02-17", "2010-08-06", "2008-02-21", "2008-06-25", "2008-04-16", "2009-04-16")
test <- c("2012-05-02", "2011-09-17", "2013-03-09", "2012-01-07", "2013-02-11", "2013-02-11")
(age <- age_completed(born, test))
age_character(age, units="years")
age_character(age, units="months")

DavideMassidda/testing documentation built on Oct. 12, 2023, 4:32 p.m.