d2a | R Documentation |
Function that converts a Date class vector of birth date values to numeric age values. This function is preparative to the a2g function.
d2a(bd)
bd |
Vector of Date class values. The date "yyyy-mm-dd" format is expected. |
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.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.