Learn R Programming

epifit (version 0.1.2)

calcAge: Calculate the difference between two date in terms of unit of time.

Description

This function calculate the difference between two date in terms of unit of time, and age can be obtained when ‘year’ is specified as unit argument.

Usage

calcAge(birthday, targetdate = Sys.Date(), unit = "year")

Arguments

birthday
a character or character vector specifying birthday or base date.
targetdate
a character or character vector specifying target date.
unit
a character specifying unit for calculating the difference between the two dates. Values of "year", "month" and "day" are supported.

Value

a vector of age

Examples

Run this code
calcAge("1963-2-3")

Run the code above in your browser using DataLab