base-cbind: Bind 'timeSeries' objects by column or row

cbindR Documentation

Bind 'timeSeries' objects by column or row

Description

Binds "timeSeries" objects either by column or by row.

Usage

## S3 method for class 'timeSeries'
cbind(..., deparse.level = 1)
## S3 method for class 'timeSeries'
rbind(..., deparse.level = 1)

## S4 method for signature 'timeSeries,ANY'
cbind2(x, y)
## other methods for 'cbind2' with the same arguments, see Details

## S4 method for signature 'timeSeries,ANY'
rbind2(x, y)
## other methods for 'rbind2' with the same arguments, see Details

Arguments

x, y

objects, at least one of whom is of class "timeSeries".

...

further arguments to bind.

deparse.level

see the documentation of base::cbind.

Details

These functions bind the objects by row rXXX or column (cXXX.

cbind and rbind are S3 generics, so the "timeSeries" methods describe here are called only when the first argument is "timeSeries".

cbind2 and rbind2 are S4 generics which dispatch on the first two arguments. The "timeSeries" methods for these are invoked whenever at least one of the first two arguments is of class "timeSeries".

All functions can be called with more than two arguments. After the first two are merged, the result is merged with the third, and so on.

Value

an object of class "timeSeries"

See Also

merge for another way to merge "timeSeries" object column-wise.

rbind and cbind from base R,

rbind2 and cbind2 from package "methods",

Examples

## Load Microsoft Data Set -
   x <- MSFT[1:12, ]
   x

## Bind Columnwise -
   X <- cbind(x[, "Open"], returns(x[, "Open"]))
   colnames(X) <- c("Open", "Return")
   X

## Bind Rowwise - 
   Y <- rbind(x[1:3, "Open"], x[10:12, "Open"])
   Y

timeSeries documentation built on Aug. 26, 2023, 5:08 p.m.