Description Usage Arguments Details Value See Also Examples
Converts beetween Date
objects and sampling times of
daily time series with the natural time period of 1 year.
1 2 | time365toDate(x)
time365fromDate(x)
|
x |
A vector of sampling times ( |
A simple approach to modelling daily time series with the natural time
period of 1 year is to use ts
object with
\code{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
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## 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")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.