[Xts-commits] r767 - pkg/xts/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 28 04:57:04 CET 2013


Author: bodanker
Date: 2013-01-28 04:57:04 +0100 (Mon, 28 Jan 2013)
New Revision: 767

Modified:
   pkg/xts/R/rollapply.xts.R
Log:
- handle fill argument


Modified: pkg/xts/R/rollapply.xts.R
===================================================================
--- pkg/xts/R/rollapply.xts.R	2013-01-25 22:48:37 UTC (rev 766)
+++ pkg/xts/R/rollapply.xts.R	2013-01-28 03:57:04 UTC (rev 767)
@@ -96,13 +96,14 @@
     if(!is.null(dim(xx))) xx <- t(xx)
     res <- xts(xx, tt, if (by == 1) attr(data, "frequency"))
   }
-  if( na.pad ) {
-    tmp <- merge(res, xts(,idx, attr(data, "frequency")))
-    if(is.null(colnames(res))) {
-      colnames(tmp) <- colnames(res)
-    }
-    res <- tmp
+  
+  ix <- index(data) %in% index(res)
+  tmp <- merge(res, xts(,idx, attr(data, "frequency")))
+  if(is.null(colnames(res))) {
+    colnames(tmp) <- colnames(res)
   }
+  res <- na.fill(tmp, fill, ix)
+
   if( by.column && !is.null(dim(data)) ) {
     colnames(res) <- colnames(data)
   }



More information about the Xts-commits mailing list