rts(x = NA, start = 1, deltat = 1, frequency = 1, end = <<see below>>, units = <<see below>>, names = NULL, eps = .Options$ts.eps) is.rts(x) as.rts(x)
c(1990,2)
. If both
start
and
end
are
missing, then the default for
start
is 1.
deltat=1/12
and bienial data has
deltat=2
.
Only one of
frequency
or
deltat
should be provided.
Default is 1.
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.
start
and
end
are given, they must be consistent with
the length of the time series.
deltat
. Default is
NULL
.
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.
deltat
and
frequency
are integer values. Default is
.Options$ts.eps
.
rts
function returns a time series object of class
"rts"
whose
data values are given by
x
.
is.rts
function returns
TRUE
if
x
is of class
"rts"
and
FALSE
otherwise.
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)
.
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.
Beware that most time series operations are not well defined for factor data.
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"))