[R] testing if xts date exists ?

ce zadig_1 at excite.com
Sat Jan 25 16:27:14 CET 2014


Dear all


How to test if xts date exists ? is.null doesn't work.  SPY["2009-01-18"] doesn't exist but I can't catch it in my script.

library(quantmod)

getSymbols("SPY")

> SPY["2009-01-16"]
           SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
2009-01-16    85.86    85.99   83.05     85.06  399237200        76.58



> SPY["2009-01-18"]
     SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted


> is.null(SPY["2009-01-18"])
[1] FALSE



More information about the R-help mailing list