On Wed, Jan 29, 2014 at 1:25 PM, ce <zadi...@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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to