Tsp Attribute of a Time Series Object

DESCRIPTION:
Returns the start, end and frequency of a time series.

USAGE:
tsp(x)
tsp(x) <- value

start(x) end(x) frequency(x)


REQUIRED ARGUMENTS:
x:
any object.
Missing values (NA) are allowed.

VALUE:
tsp returns the tsp attribute of x, which will be NULL if x is not a time series. The tsp attribute has three values giving the starting time, ending time, and the observation frequency of the time series.

start and end return their times as a pair of numbers: an integer number of time units, and the number of observations times after that integer. For example, for monthly series, with frequency(x) equal to 12, these are year and month.

frequency returns an integer giving the number of observations per unit time.


DETAILS:
To explicitly delete the tsp attribute, use tsp(x) <- NULL.

If s is start(x) and t is tsp(x), then t[1] is the same as s[1]+(s[2]-1)/t[3]. The output for end is analogous.

The tsp function is generic, though it currently has no methods defined for it. This makes the start, end and frequency functions essentially generic since they depend on tsp.


NOTE:
Time series created by ts have been superseded by the classed time series created by rts, cts, and its. You can coerce a old-style time series to a new with as.rts. View the time parameters of the new time series with tspar.

SEE ALSO:
as.rts , cts , its , rts , ts , tsmatrix , tspar .

EXAMPLES:
# find the tsp attribute of the ship dataset
tsp(ship)      # 1967.000 1974.917 12.000
start(ship)    # 1967
end(ship)      # 1974  12
frequency(ship)     # 12

# create a time series beginning at same time as ship newdata <- rts(data, start = start(ship), frequency = frequency(ship))