Regular Time Series Objects

DESCRIPTION:
Defines a univariate or multivariate regularly spaced time series.

USAGE:
rts(x = NA, start = 1, deltat = 1, frequency = 1, end = <<see below>>,
    units = NULL, names = NULL, eps = .Options$ts.eps)
is.rts(x)
as.rts(x)

REQUIRED ARGUMENTS:
x:
a vector, matrix, factor, or data frame containing the data values for the time series.

OPTIONAL ARGUMENTS:
start:
a single numeric value giving starting time for the series, or a pair of values giving the numeric base time and an integer offset representing the number of positions into the sampling period for the sampling time of the the first observation of the series (e.g., February 1990 could be c(1990,2). If both start and end are missing, then the default for start is 1.
deltat:
fraction of the sampling period between successive observations; e.g., monthly data has deltat=1/12 and bienial data has deltat=2. Only one of frequency or deltat should be provided. Default is 1.
frequency:
number of observations per sampling period, e.g. 12 for monthly data in a year. frequency is the reciprocal of deltat. Only one of deltat or frequency should be provided. Default is 1.
end:
single numeric value giving ending time for the series or a pair of values giving the numeric base time and an integer offset representing the number of positions into the sampling period for the sampling time of the last observation of the series. Default is the length of the time series. If both start and end are given, they must be consistent with the length of the time series.
units:
character string representing the units in which the time domain is measured, that is, the units of deltat. Default is NULL.
names:
(multivariate data only): a vector of character strings to be used as names for the component series of the multivariate series. The default is to use the dimnames for x if x is a matrix or a data frame, or the strings "Series 1", "Series 2", ..., etc. if dimnames(x) = NULL. In the case of data frames, names overrides existing column names.
eps:
a very small number used as the tolerance for deciding whether or not deltat and frequency are integer values. Default is .Options$ts.eps.

VALUE:
The rts function returns a time series object of class "rts" whose data values are given by x.

The is.rts function returns TRUE if x is of class "rts" and FALSE otherwise.

The as.rts function coerces calendar time series (objects of class "cts") and ts objects (time series objects from version 3.1 or earlier with a tsp attribute) to regular time series object of class "rts". If x is neither, then as.rts(x) returns rts(x).


DETAILS:
The rts function checks for consistency in its arguments. Arrays with more than two dimensions are treated as vectors. The as.rts function converts an old-style time series to a time series of class "rts".

Any data measured at regular time intervals can be represented as a regular time series. Hourly data might use an integer representing days for start and end with frequency=24 or deltat=1/24; daily data could use weeks with frequency=7 or deltat=1/7.

Time series objects are those that have a tspar attribute. For regular time series, the tspar attribute is an ordered vector with three labeled components start, deltat, and frequency. The tspar attribute may optionally have a units attribute giving the units in which deltat is measured.

Factors and data frames can be redefined as time series. The resulting series has class c("rts","factor") or c("rts","data.frame"). Beware that most time series operations are not well defined for factor data.


SEE ALSO:
cts , data.frame , dates , its , tspar , units .

EXAMPLES:
x <- rts(rnorm(100), start = c(1953, 4), frequency = 12)
is.rts(x)
lynx.rts <- as.rts(lynx)
corn.rts <- rts(cbind(corn.rain, corn.yield), start = 1890,
                units = "years", names = c("rain", "yield"))