TimeSeriesSubsettings | R Documentation |
Objects from class "timeSeries"
can be subsetted in different
ways. Methods are defined for the subsetting operators "$"
,
"["
and their assignment versions, as well as for some related
functions from base R. A function to drop or extract outliers is also
described here.
## S3 method for class 'timeSeries'
head(x, n = 6, recordIDs = FALSE, ...)
## S3 method for class 'timeSeries'
tail(x, n = 6, recordIDs = FALSE, ...)
outlier(x, sd = 5, complement = TRUE, ...)
x |
an object of class |
n |
an integer specifying the number of lines to be returned.
By default |
recordIDs |
a logical value. Should the |
sd |
a numeric value of standard deviations, e.g. 10 means that values larger or smaller than ten times the standard deviation will be removed from the series. |
complement |
a logical flag. If |
... |
arguments passed to other methods. |
The "timeSeries"
methods for the subsetting operators "$"
,
"["
and their assignment versions, as well as for the functions
head
and tail
are meant to do what the user expects.
TODO: Further details are needed here, despite the above paragraph.
outlier
drops the outliers if complement = TRUE
and
returns only them if complement = FALSE
.
All functions described here return "timeSeries"
objects.
See also window
which extracts the sub-series between
two datetimes.
All functions return an object of class "timeSeries"
.
window
## Create an Artificial 'timeSeries' Object
setRmetricsOptions(myFinCenter = "GMT")
charvec <- timeCalendar()
set.seed(4711)
data <- matrix(exp(cumsum(rnorm(12, sd = 0.1))))
tS <- timeSeries(data, charvec, units = "tS")
tS
## Subset Series by Counts "["
tS[1:3, ]
## Subset the Head of the Series
head(tS, 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.