Hi there, I would like to omit some observations of a zoo vector
corresponding with some defined dates. So I wrote following codes:
> set.seed(1)
> dates <- seq(as.Date("2011-01-01"), as.Date("2011-01-31"), by="1
day")[-c(7,8,9,20,21,22)]
> mySeries <- zoo(rnorm(25), dates)
> mySeries
2011-01-01 2011-01-02 2011-01-03 2011-01-04 2011-01-05 2011-01-06
2011-01-10 2011-01-11 2011-01-12 2011-01-13 2011-01-14 2011-01-15
-0.62645381 0.18364332 -0.83562861 1.59528080 0.32950777 -0.82046838
0.48742905 0.73832471 0.57578135 -0.30538839 1.51178117 0.38984324
2011-01-16 2011-01-17 2011-01-18 2011-01-19 2011-01-23 2011-01-24
2011-01-25 2011-01-26 2011-01-27 2011-01-28 2011-01-29 2011-01-30
-0.62124058 -2.21469989 1.12493092 -0.04493361 -0.01619026 0.94383621
0.82122120 0.59390132 0.91897737 0.78213630 0.07456498 -1.98935170
2011-01-31
0.61982575
> toOmit <- as.Date(c("2011-01-07", "2011-01-08", "2011-01-09"))
> mySeries[-toOmit]
Error in `-.Date`(toOmit) : unary - is not defined for Date objects
Can somebody point me how to rectify that error?
Thanks and regards,
[[alternative HTML version deleted]]
_______________________________________________
[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.