#TS DESCRIPTION#
Time-Series Objects
Description
The function ts is used to create time-series objects.
as.ts and is.ts coerce an object to a time-series and test whether an object is a time series.
Usage
ts(data = NA, start = 1, end = numeric(0), frequency = 1,deltat = 1, ts.eps = getOption("ts.eps"), class = , names = )
as.ts(x, ...)
is.ts(x)
Arguments
data
a numeric vector or matrix of the observed time-series values. A data frame will be coerced to a numeric matrix via data.matrix.
start
the time of the first observation. Either a single number or a vector of two integers, which specify a natural time unit and a (1-based) number of samples into the time unit. See the examples for the use of the second form.
end
the time of the last observation, specified in the same way as start.
frequency
the number of observations per unit of time.
deltat
the fraction of the sampling period between successive observations; e.g., 1/12 for monthly data. Only one of frequency or deltat should be provided.
ts.eps
time series comparison tolerance. Frequencies are considered equal if their absolute difference is less than ts.eps.
class
class to be given to the result, or none if NULL or "none". The default is "ts" for a single series, c("mts", "ts") for multiple series.
names
a character vector of names for the series in a multiple series: defaults to the colnames of data, or Series 1, Series 2, ....
x
an arbitrary R object.
...
arguments passed to methods (unused for the default method).
EXAMPLE:
> xx<-ts(1:1095,start=c(2011,1,1),frequency=365) #DATA=1:1095;起始时间是2011年1月1日;一年为一个周期