window(): feature request
On Mon, 3 Apr 2000, Wolfgang Koller wrote:
Dear R-developpers, currently the function window shows the following behaviour, if start or end is out of range:
x <- ts(1:14,start=c(1950,2),frequency=4) y <- window(x,start=c(1950,1),end=c(1953,4))
Warning messages: 1: start value not changed in: window.default(x, ...) 2: end value not changed in: window.default(x, ...) Instead of this I would like it to fill with NAs the values before start(x) and after end(x). Could this be done by introducing an additional option in window()? Could you please consider this in future releases? Or is there a better way to do this using existing functions?
This is incompatible with S and the existing behaviour, so I have added a new argument `extend' defaulting to FALSE. The new version is in the R-devel distribution, so will not appear in a released version until 1.1.0.
P.S.: Below I have added some code that accomplishes this aim in a separate function (which is probably an example of akward programming...).
[It does not handle matrix ts objects, for example, nor does it handle changing the frequency.] [code snipped.] PS: R-bugs now has a `wishlist' section, so sending a feature request as a bug report is a way to ensure it gets recorded.
Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._