split.xts | R Documentation |
Creates a list of xts objects split along time periods.
## S3 method for class 'xts'
split(x, f = "months", drop = FALSE, k = 1, ...)
x |
An xts object. |
f |
A character vector describing the period to split by. |
drop |
Ignored by |
k |
Number of periods to aggregate into each split. See details. |
... |
Further arguments passed to other methods. |
A quick way to break up a large xts object by standard time periods; e.g. 'months', 'quarters', etc.
endpoints()
is used to find the start and end of each period (or
k-periods). See that function for valid arguments.
The inputs are passed to split.zoo()
when f
is not a character vector.
A list of xts objects.
aggregate.zoo()
is more flexible, though not
as fast for xts objects.
Jeffrey A. Ryan
endpoints()
, split.zoo()
,
aggregate.zoo()
data(sample_matrix)
x <- as.xts(sample_matrix)
split(x)
split(x, f="weeks")
split(x, f="weeks", k=4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.