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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 25 04:10:07 CET 2013


Author: bodanker
Date: 2013-01-25 04:10:06 +0100 (Fri, 25 Jan 2013)
New Revision: 765

Modified:
   pkg/xts/R/rollapply.xts.R
Log:
- fix error when input has 1 col, but function output has > 1 col


Modified: pkg/xts/R/rollapply.xts.R
===================================================================
--- pkg/xts/R/rollapply.xts.R	2013-01-20 15:15:53 UTC (rev 764)
+++ pkg/xts/R/rollapply.xts.R	2013-01-25 03:10:06 UTC (rev 765)
@@ -81,6 +81,7 @@
     #xx <- sapply(1:NROW(e), function(i) FUN(data[e[i,],],...))
     ##xx <- sapply(ind, function(i) FUN(data[(i-width+1):i,],...))
     xx <- sapply(ind, function(i) FUN(.subset_xts(data,(i-width+1):i),...))
+    if(!is.null(dim(xx))) xx <- t(xx)
     res <- xts(xx, tt, if (by == 1) attr(data, "frequency"))
   } else if( by.column ) {
     res <- xts( sapply( 1:NCOL(data), function(j)



More information about the Xts-commits mailing list