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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 6 21:48:08 CET 2013


Author: bodanker
Date: 2013-12-06 21:48:07 +0100 (Fri, 06 Dec 2013)
New Revision: 798

Modified:
   pkg/xts/R/xts.methods.R
Log:
- Update [.xts to handle 'i' containing multiple zeros (e.g. subsetting by a
  "logical" column of an integer xts object)


Modified: pkg/xts/R/xts.methods.R
===================================================================
--- pkg/xts/R/xts.methods.R	2013-11-18 15:02:23 UTC (rev 797)
+++ pkg/xts/R/xts.methods.R	2013-12-06 20:48:07 UTC (rev 798)
@@ -113,7 +113,7 @@
     # subset is picky, 0's in the 'i' position cause failures
     zero.index <- binsearch(0, i, NULL)
     if(!is.na(zero.index))
-      i <- i[ -zero.index ]
+      i <- i[ -1L:-zero.index ]  # at least one 0; binsearch returns location of last 0
 
     if(length(i) <= 0 && USE_EXTRACT) 
       USE_EXTRACT <- FALSE



More information about the Xts-commits mailing list