Learn R Programming

ageg (version 1.0.0)

d2a: Date to Age

Description

Function that converts a Date class vector of birth date values to numeric age values. This function is preparative to the a2g function.

Usage

d2a(bd)

Value

Returns a numeric class vector object of ages if the function is provided a Date class object. The function will otherwise return an error message stating that the function requires a Date class object.

Arguments

bd

Vector of Date class values. The date "yyyy-mm-dd" format is expected.

Examples

Run this code
datevals <- as.Date(c("2019-01-01","1920-12-12","1980-02-02","1991-03-03" ))


d2a(datevals)

# > d2a(datevals)
# [1]  3 101  42  31

Run the code above in your browser using DataLab