mdy.date {date} | R Documentation |
Given a month, day, and year, returns the number of days since January 1, 1960.
mdy.date(month, day, year, nineteen = TRUE, fillday = FALSE,
fillmonth = FALSE)
month |
vector of months. |
day |
vector of days. |
year |
vector of years. |
nineteen |
if |
fillday |
if |
fillmonth |
if |
The date functions are particularly useful in computing time spans, such as number of days on test, and similar functions can be found in other statistical packages. The baseline date of Jan 1, 1960 is, of course, completely arbitrary (it is the same one used by SAS).
The fillday
and fillmonth
options are perhaps useful
only to the author and a very few others: we sometimes deal with
patients whose birth date was in the 1800's, and only the month or
even only the year is known. When the interval is greater than 80
years, a filler seems defensible.
a vector of Julian dates.
Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P. (1992). Numerical Recipes: The Art of Scientific Computing (Second Edition). Cambridge University Press.
date.mmddyy
,
date.ddmmmyy
,
date.mmddyyyy
mdy.date(3, 10, 53)
xzt <-1:10
xzy <- as.date(xzt)
test <- data.frame(x = xzt, date = xzy)
summary(test)