[R] xts objects comparison
josh.m.ulrich at gmail.com
Thu Nov 14 15:26:46 CET 2013
On Thu, Nov 14, 2013 at 2:26 AM, Tstudent <tstudent at gmail.com> wrote:
> I have the following two xts object:
> With str i see that they are both xts objects
> I can't understand why it's impossible to compare each element.
> For example: series1 > series2
> Why i don't get an xts object with a sequence of true and false?
Because series1 has a POSIXct index and series2 has a yearmon index.
The two objects have no index values in common, so there's nothing to
Convert series1's index to yearmon, and the comparison works.
> index(series1) <- as.yearmon(index(series1))
> tail(series1 > series2)
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
More information about the R-help