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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 31 16:51:55 CEST 2012


Author: bodanker
Date: 2012-07-31 16:51:55 +0200 (Tue, 31 Jul 2012)
New Revision: 699

Modified:
   pkg/xts/R/xts.methods.R
Log:
- add length check on 'i' in [.xts to avoid Warning from max(i)


Modified: pkg/xts/R/xts.methods.R
===================================================================
--- pkg/xts/R/xts.methods.R	2012-07-31 02:32:51 UTC (rev 698)
+++ pkg/xts/R/xts.methods.R	2012-07-31 14:51:55 UTC (rev 699)
@@ -51,7 +51,9 @@
           stop('only zeros may be mixed with negative subscripts')
         i <- (1:nr)[i]
       }
-      if(max(i) > nr)
+      # check boundary; length check avoids Warning from max(), and
+      # any_negative ensures no NA (as of r608)
+      if(length(i) > 0 && max(i) > nr)
         stop('subscript out of bounds')
       #i <- i[-which(i == 0)]
     } else



More information about the Xts-commits mailing list