On Wed, Jan 29, 2014 at 1:25 PM, ce <zadig_1 at excite.com>
wrote:>
> Dear all ,
>
> xts objects give error in if command :
> Error in if .... :
> missing value where TRUE/FALSE needed
>
>> library(quantmod)
>> getSymbols("SPY")
>
>> SPY["2007-01-03"]$SPY.Adjusted >
SPY["2007-01-04"]$SPY.Adjusted
> [,1]
>
> If I use as.numeric function it works :
>
>> SPY["2007-01-03"]$SPY.Adjusted >
as.numeric(SPY["2007-01-04"]$SPY.Adjusted)
> SPY.Adjusted
> 2007-01-03 FALSE
>
>> as.numeric(SPY["2007-01-03"]$SPY.Adjusted) >
as.numeric(SPY["2007-01-04"]$SPY.Adjusted)
> [1] FALSE
>
>
> Is this the expected behavior ?
>
Yes, see: http://stackoverflow.com/q/7097437/271616
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com