From noreply at r-forge.r-project.org Fri Dec 6 21:48:08 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 6 Dec 2013 21:48:08 +0100 (CET) Subject: [Xts-commits] r798 - pkg/xts/R Message-ID: <20131206204808.152EF18621F@r-forge.r-project.org> 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 From noreply at r-forge.r-project.org Sun Dec 15 19:23:04 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 15 Dec 2013 19:23:04 +0100 (CET) Subject: [Xts-commits] r799 - pkg/xts/R Message-ID: <20131215182304.79A4A186ACA@r-forge.r-project.org> Author: bodanker Date: 2013-12-15 19:23:04 +0100 (Sun, 15 Dec 2013) New Revision: 799 Modified: pkg/xts/R/xts.methods.R Log: - [.xts more robust to multiple zeros in 'i' Modified: pkg/xts/R/xts.methods.R =================================================================== --- pkg/xts/R/xts.methods.R 2013-12-06 20:48:07 UTC (rev 798) +++ pkg/xts/R/xts.methods.R 2013-12-15 18:23:04 UTC (rev 799) @@ -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[ -1L:-zero.index ] # at least one 0; binsearch returns location of last 0 + i <- i[i!=0] # at least one 0; remove them all if(length(i) <= 0 && USE_EXTRACT) USE_EXTRACT <- FALSE