On Thu, Nov 14, 2013 at 2:26 AM, Tstudent <tstudent at gmail.com>
wrote:> I have the following two xts object:
>
> https://dl.dropboxusercontent.com/u/102669/series1.rdata
>
> https://dl.dropboxusercontent.com/u/102669/series2.rdata
>
> 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
compare.
Convert series1's index to yearmon, and the comparison works.
> index(series1) <- as.yearmon(index(series1))
> tail(series1 > series2)
GSPC
2013-06-01 TRUE
2013-07-01 TRUE
2013-08-01 TRUE
2013-09-01 TRUE
2013-10-01 TRUE
2013-11-01 TRUE
Best,
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com