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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 21 16:27:11 CEST 2013


Author: bodanker
Date: 2013-04-21 16:27:11 +0200 (Sun, 21 Apr 2013)
New Revision: 770

Modified:
   pkg/xts/R/xts.methods.R
Log:
- patch zero-width xts subsetting (bug #2669)


Modified: pkg/xts/R/xts.methods.R
===================================================================
--- pkg/xts/R/xts.methods.R	2013-04-02 00:40:32 UTC (rev 769)
+++ pkg/xts/R/xts.methods.R	2013-04-21 14:27:11 UTC (rev 770)
@@ -34,8 +34,13 @@
     USE_EXTRACT <- FALSE # initialize to FALSE
     if(is.null(dim(x))) {
       nr <- length(x)
-      if(nr==0) 
-        return( .xts(rep(NA,length(i)), .index(x)[i], .indexCLASS=indexClass(x)) )
+      if(nr==0) {
+        ix <- .index(x)
+        tmp <- .xts(rep(NA,length(ix)), ix)
+        indexClass(tmp) <- indexClass(x)
+        indexTZ(tmp) <- indexTZ(x)
+        return(tmp[i])
+      }
       nc <- 1L
     } else {
       nr <- nrow(x)



More information about the Xts-commits mailing list