I'm not sure why you expect my.object[!"2015/2015-03-01"] to work. Applying a logical function to a character string does not make sense.
Regardless, one way to achieve what you want is to use the which.i argument to [.xts to find integer indices. You can then remove these observations from your xts object using negative i in another call to [.xts .
R> require(xts) R> data(sample_matrix) R> x <- as.xts(sample_matrix) R> unwantedObs <- x["2007-01-04/2007-06-28", which.i=TRUE] R> x[-unwantedObs,] Open High Low Close 2007-01-02 50.03978 50.11778 49.95041 50.11778 2007-01-03 50.23050 50.42188 50.23050 50.39767 2007-06-29 47.63629 47.77563 47.61733 47.66471 2007-06-30 47.67468 47.94127 47.67468 47.76719 R> # in one line: R> #x[-x["2007-01-04/2007-06-28", which.i=TRUE],]
Joshua Ulrich Aug 15 '15 at 21:40 2015-08-15 21:40
source share