On Fri, Mar 4, 2011 at 9:30 AM, Bogaso <[email protected]> wrote:
> Thanks Gabor for this fix. However I was expecting that the index
> '2011-01-02' would not be there in final "MyData" because in the original
> "MyData" that was not there.
>
I don't think most people would expect that since that is not how R
works, in general. Consider this example that does not involve zoo.
Here we see that index 11 was assigned to even though its not in the
original object:
> x <- 1:10
> x[8:11] <- NA
> x
[1] 1 2 3 4 5 6 7 NA NA NA NA
At any rate to set those dates that exist within a window you can use
window like this:
> library(zoo)
> MyData <- zooreg(rnorm(60), start=as.Date("2011-01-01"))[-2]
> window(MyData, start = "2011-01-01", end = "2011-01-03") <- NA
> head(MyData)
2011-01-01 2011-01-03 2011-01-04 2011-01-05 2011-01-06 2011-01-07
NA NA 0.8294499 -1.2468697 -0.4004666 1.3487024
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should
go.