| days1 {ssBase} | R Documentation |
These functions act in a similar way as the chron functions days, months and years. See “Details” below.
days1(x) months1(x) years1(x)
x |
a datetimes object. |
The datetimes object is a numeric vector containing the number of days and fractions thereof from some defined origin, often 1 Jan 1970.
In versions of chron prior to 2.2-35, there was a bug. This caused the functions days, months, and years to sometimes be erroneous for dates before the origin. For example, chron(dates.="12/31/1969", times.="18:00:00") would give "01/01/1970 -6:00:00". This appears to have been fixed in version 2.2-35. It was probably caused by a call to trunc in month.day.year rather than floor.
Another difference is that the values returned by the chron functions days, months, and years are ordered factors. This is not the case for days1, months1 and years1.
A numeric vector of the same length as x giving either the day of the month (1, ..., 31), the month (1, ..., 12), or the year (e.g. 1998).
datetimes, days, months, years, hrs.mins.secs
x <- julian(12,31,1969) + 18/24 print(x) # x represents 18:00:00 hrs on 31 Dec 1969 # x = -1 + 18/24 = -0.25 x <- datetimes(1998, 6, 2, 13, 34, 25.9, dp.second=1) print(days1(x)) print(months1(x)) print(years1(x)) print(hrs.mins.secs(x))