[Xts-commits] r744 - in pkg/xts: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 26 18:06:19 CET 2012


Author: jryan
Date: 2012-11-26 18:06:18 +0100 (Mon, 26 Nov 2012)
New Revision: 744

Modified:
   pkg/xts/R/xts.R
   pkg/xts/man/xts.Rd
Log:
o  xts() now ignores TZ and tzone= settings when order.by is
   of class "Date".  This allows for Date handling to be consistent
   regardless of localtime (as expected), and assures portable
   objects across TZ settings.  If POSIXct and Date based xts objects
   are mixed, the result will be undefined, as POSIXct has no notion
   of individual 'dates', only [sub]seconds since the epoch. This should
   break some code, but make TZ behavior of xts objects more inline
   with most use cases.  When in doubt, use only one. The special case
   of POSIXct with UTC and Date will align.


Modified: pkg/xts/R/xts.R
===================================================================
--- pkg/xts/R/xts.R	2012-11-21 18:44:53 UTC (rev 743)
+++ pkg/xts/R/xts.R	2012-11-26 17:06:18 UTC (rev 744)
@@ -47,13 +47,16 @@
 
   if(inherits(order.by, 'dates'))
     tzone <- ""
+
+  if(inherits(order.by, 'Date') && missing(tzone))
+    tzone <- "UTC"
   
   #if(NROW(x) != length(order.by))
   if(NROW(x) > 0 && NROW(x) != length(order.by))
     stop("NROW(x) must match length(order.by)")
 
   orderBy <- class(order.by)
-  if(inherits(order.by, 'Date') && !missing(tzone))
+  if(inherits(order.by, 'Date'))
     # convert to GMT POSIXct if specified
     order.by <- .POSIXct(unclass(order.by)*86400, tz=tzone)
 

Modified: pkg/xts/man/xts.Rd
===================================================================
--- pkg/xts/man/xts.Rd	2012-11-21 18:44:53 UTC (rev 743)
+++ pkg/xts/man/xts.Rd	2012-11-26 17:06:18 UTC (rev 744)
@@ -24,7 +24,7 @@
 of a known time-based class. See details. }
   \item{frequency}{ numeric indicating frequency of \code{order.by}. See details. }
   \item{unique}{ should index be checked for unique time-stamps? }
-  \item{tzone}{ time zone of series }
+  \item{tzone}{ time zone of series.  This is ignored for Date indices }
   \item{\dots}{ additional attributes to be added. See details. }
 }
 \details{



More information about the Xts-commits mailing list