xtsAlign: Align one xts object to another without merging them.

Description Usage Arguments Value Examples

View source: R/xtsAlign.R

Description

This function aligns two xts objects so that they will have the same date indexing. The default join method is "inner." See the documentation for merge.xts for different join methods, although this operation probably only makes sense using an "inner" join.

Usage

1
xtsAlign(target, match.to, join = "inner")

Arguments

target

the xts object you would like to modify.

match.to

the xts object you would like to emulate or align to.

join

the type of database join to use in matching. Default is "inner". Other methods could lead to strange results.

Value

an xts object whose date index is now aligned with match.to.

Examples

1
2
3
4
5
6
7
8
9
dts.long <- seq(Sys.Date()-49, Sys.Date(), 1)
ret.long <- matrix(rnorm(50),ncol = 1) / 100
long.xts <- xts(ret.long, dts.long)

dts.short <- seq(Sys.Date()-9, Sys.Date(), 1)
ret.short <- matrix(rnorm(10),ncol = 1) / 100
short.xts <- xts(ret.short, dts.short)

xtsAlign(target = long.xts, match.to = short.xts)

gtog/dMisc documentation built on May 17, 2019, 8:57 a.m.