time365 {cmrutils} | R Documentation |
Converts beetween Date
objects and sampling times of
daily time series with the natural time period of 1 year.
time365toDate(x) time365fromDate(x)
x |
A vector of sampling times (time365toDate ) or dates
(time365fromDate ).
|
A simple approach to modelling daily time series with the natural time
period of 1 year is to use ts
object with
frequency
= 365, that is to assume no leap days.
time365fromDate
returns NA
for the leap day February 29.
A vector of dates (time365fromDate
) or sampling times
(time365toDate
).
time
.
## non-leap year x <- ts(1:4, start = c(1991, 58), frequency = 365) time365toDate(time(x)) d <- seq.Date(as.Date('1991-02-27'), as.Date('1991-03-02'), 1) time365fromDate(d) ## leap year x <- ts(1:4, start = c(1992, 58), frequency = 365) time365toDate(time(x)) d <- seq.Date(as.Date('1992-02-27'), as.Date('1992-03-02'), 1) time365fromDate(d) x <- seq(1900, 2100, by = 1/365) stopifnot(all(abs(x - time365fromDate(time365toDate(x))) < getOption("ts.eps")))