time Sampling Times of Time Series
Description
time creates the vector of times at which a time series was sampled.
cycle gives the positions in the cycle of each observation.
frequency returns the number of samples per unit time and deltat the time interval between observations (see ts).
Usage
time(x, ...) ## Default S3 method: time(x, offset = 0, ...) cycle(x, ...) frequency(x, ...) deltat(x, ...)
Arguments
x | a univariate or multivariate time-series, or a vector or matrix. |
offset | can be used to indicate when sampling took place in the time unit. |
... | extra arguments for future methods. |
Details
These are all generic functions, which will use the tsp attribute of x if it exists. time and cycle have methods for class ts that coerce the result to that class.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
See Also
date for clock time, system.time for CPU usage.
Examples
require(graphics) cycle(presidents) # a simple series plot plot(as.vector(time(presidents)), as.vector(presidents), type = "l")
Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.