its-def {its} | R Documentation |
The function its
is used to create irregular time-series
objects.
as.its
coerces an object to an irregularly spaced
time-series. is.its
tests whether an object is an irregularly
spaced time series.
its(x,dates=as.POSIXct(x=strptime(dimnames(x)[[1]],format=its.format())), names=dimnames(x)[[2]],format=its.format(),...) as.its(x,...) is.its(object) its.format(format=NULL)
dates |
a vector of class "POSIXct"
representing the time-stamps of the irregular time-series
object. The elements of the numeric vector are construed as the
number of seconds since the beginning of 1970, see
POSIXct . |
x |
a numeric matrix representing the values of the
irregular time-series object. In the case of coercion, the first
column is taken to be the time-stamps, in seconds since the beginning
of 1970, see POSIXct . |
object |
an irregular time-series object |
names |
a vector of mode character |
format |
a formatting string, see format.POSIXct ,
defaults to "%Y-%m-%d" if format is not specified. |
... |
further arguments passed to or from other methods:
for its passed to format.POSIXct .;
for as.its passed to its |
The function its is used to create irregular time-series ("its") objects. An object of class "its" is a matrix with rows indexed by a time-stamp of class "POSIXct". Unlike objects of class "ts", it can be used to represent irregularly spaced time-series. The object consists of a matrix, with a single slot, the named POSIX vector named "dates". An object of class its inherits matrix arithmetic methods. The matrix has dimnames: dimnames[[1]] is populated with a text representation of "dates", using a format which is defined by the function its.format. These text dates are not used in computations - all computations use the POSIX representation. The dates are required to be in ascending order.
When matrix multiplication is applied to an "its", the result is of class matrix. It is possible to restore the "its" class (see examples) - its() is in this sense idempotent i.e. its(mat)==its(its(mat)).
its.format returns a formatting string, and assigns a format variable
its..format
globally, which persists in the session until reset.
For its
and as.its
, an object of class "its"
, inheriting
from matrix, with a single slot named 'dates'
, which is a vector of
class POSIXct
For is.its
, a logical representing the result of a test for class membership
For its.format
, a text representation of dates formatting for dimnames,
see format.POSIXct
Giles Heywood
ts
,
POSIXct
,
its-file
,
its-lags
its-join
its-times
its-subset
its-fin
its-disp
its-info
its-cumdif
its-arith
its.format("%Y-%m-%d") #defines text format of dates read from dimnames mat <- structure(1:6,dim=c(2,3),dimnames=list(c("2003-01-01","2003-01-04"),letters[1:3])) its(mat) its.format("%Y%m%d") #defines text format of dates written to dimnames times <- as.POSIXct(strptime(c("1999-12-31 01:00:00","2000-01-01 02:00:00"),format="%Y-%m-%d %X")) its(mat,times) its.format("%Y-%m-%d %X") its(mat,times) is.its(its(mat,times)) its.format("%Y%m%d %X") #defines text format of dates written to dimnames as.its(mat)