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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 11 05:49:13 CET 2012


Author: jryan
Date: 2012-11-11 05:49:10 +0100 (Sun, 11 Nov 2012)
New Revision: 741

Modified:
   pkg/xts/R/endpoints.R
Log:
o  very experimental fix for endpoints when k= is specified
   with on='months'.  This is likely the correct direction,
   but needs more testing - pushed here to allow for that


Modified: pkg/xts/R/endpoints.R
===================================================================
--- pkg/xts/R/endpoints.R	2012-11-08 13:56:50 UTC (rev 740)
+++ pkg/xts/R/endpoints.R	2012-11-11 04:49:10 UTC (rev 741)
@@ -47,7 +47,11 @@
 
   if(on == 'months') {
     #as.integer(c(0, which(diff(posixltindex$mon %/% k + 1) != 0), NR) )
-    .Call("endpoints", posixltindex$mon, 1L, k, PACKAGE='xts')
+    # x[which(diff(as.POSIXlt(index(x))$mon) != 0)[seq(0,328,12)]]
+    ep <- .Call("endpoints", posixltindex$mon, 1L, 1L, PACKAGE='xts')
+    if(k > 1)
+      ep[seq(0,length(ep),k)]
+    else ep
   } else 
   if(on == 'weeks') {
     #as.integer(c(0, which(diff( (.index(x) + (3L * 86400L)) %/% 604800L %/% k + 1) != 0), NR) )



More information about the Xts-commits mailing list