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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 15 06:05:42 CET 2013


Author: jryan
Date: 2013-01-15 06:05:42 +0100 (Tue, 15 Jan 2013)
New Revision: 752

Modified:
   pkg/xts/DESCRIPTION
   pkg/xts/NAMESPACE
   pkg/xts/R/coredata.xts.R
   pkg/xts/R/indexClass.R
   pkg/xts/R/indexTZ.R
   pkg/xts/man/indexClass.Rd
   pkg/xts/man/indexTZ.Rd
Log:
o  added tzone and tclass functions as aliases to
   indexTZ and indexClass, respectively. Eventually
   will Deprecate/Defunct the former.


Modified: pkg/xts/DESCRIPTION
===================================================================
--- pkg/xts/DESCRIPTION	2012-12-29 04:30:24 UTC (rev 751)
+++ pkg/xts/DESCRIPTION	2013-01-15 05:05:42 UTC (rev 752)
@@ -1,8 +1,8 @@
 Package: xts
 Type: Package
 Title: eXtensible Time Series
-Version: 0.9-1
-Date: 2012-10-05
+Version: 0.9-2
+Date: 2013-01-14
 Author: Jeffrey A. Ryan, Joshua M. Ulrich
 Depends: zoo (>= 1.7-2)
 LinkingTo: zoo (>= 1.7.2)

Modified: pkg/xts/NAMESPACE
===================================================================
--- pkg/xts/NAMESPACE	2012-12-29 04:30:24 UTC (rev 751)
+++ pkg/xts/NAMESPACE	2013-01-15 05:05:42 UTC (rev 752)
@@ -63,11 +63,16 @@
 export('CLASS<-')
 export(indexFormat)
 export('indexFormat<-')
+
 export(indexClass)
 export('indexClass<-')
+export(tclass)
+export('tclass<-')
 
 export(indexTZ)
 export('indexTZ<-')
+export(tzone)
+export('tzone<-')
 
 export(convertIndex)
 export(nseconds,
@@ -170,11 +175,18 @@
 S3method(print,xts)
 S3method(print,CLASS)
 S3method('CLASS<-',xts)
+
 S3method('indexClass<-',xts)
+S3method('tclass<-',xts)
+
 S3method('indexFormat<-',xts)
 S3method('indexFormat<-',xts)
+
 S3method(indexTZ,xts)
 S3method('indexTZ<-',xts)
+S3method(tzone,xts)
+S3method('tzone<-',xts)
+
 S3method('index',xts)
 S3method('index<-',xts)
 S3method('time<-',xts)

Modified: pkg/xts/R/coredata.xts.R
===================================================================
--- pkg/xts/R/coredata.xts.R	2012-12-29 04:30:24 UTC (rev 751)
+++ pkg/xts/R/coredata.xts.R	2013-01-15 05:05:42 UTC (rev 752)
@@ -95,13 +95,13 @@
 
   if(is.null(user)) {
   # Both xts and user attributes
-    rm.attr <- c(rm.attr,'.CLASS','.CLASSnames','.ROWNAMES', '.indexCLASS', '.indexFORMAT', '.indexTZ')
+    rm.attr <- c(rm.attr,'.CLASS','.CLASSnames','.ROWNAMES', '.indexCLASS', '.indexFORMAT', '.indexTZ', 'tzone', 'tclass')
     xa <- x.attr[!names(x.attr) %in% rm.attr]
   }
   else
   if(user) {
   # Only user attributes
-    rm.attr <- c(rm.attr,'.CLASS','.CLASSnames','.ROWNAMES', '.indexCLASS', '.indexFORMAT','.indexTZ', 
+    rm.attr <- c(rm.attr,'.CLASS','.CLASSnames','.ROWNAMES', '.indexCLASS', '.indexFORMAT','.indexTZ','tzone','tclass', 
                  x.attr$.CLASSnames)
     xa <- x.attr[!names(x.attr) %in% rm.attr]
   } else {

Modified: pkg/xts/R/indexClass.R
===================================================================
--- pkg/xts/R/indexClass.R	2012-12-29 04:30:24 UTC (rev 751)
+++ pkg/xts/R/indexClass.R	2013-01-15 05:05:42 UTC (rev 752)
@@ -25,7 +25,7 @@
   x
 }
 
-`indexClass` <-
+tclass <- indexClass <-
 function(x) {
   class <- attr(attr(x, "index"), "tclass")
   if(is.null(class))
@@ -34,12 +34,17 @@
     class
 }
 
+`tclass<-` <-
+function(x,value) {
+  UseMethod('tclass<-')
+}
+
 `indexClass<-` <-
 function(x,value) {
   UseMethod('indexClass<-')
 }
 
-`indexClass<-.xts` <-
+`tclass<-.xts` <- `indexClass<-.xts` <-
 function(x, value) {
   if(!is.character(value) && length(value) != 1)
     stop('improperly specified value for indexClass')

Modified: pkg/xts/R/indexTZ.R
===================================================================
--- pkg/xts/R/indexTZ.R	2012-12-29 04:30:24 UTC (rev 751)
+++ pkg/xts/R/indexTZ.R	2013-01-15 05:05:42 UTC (rev 752)
@@ -23,23 +23,32 @@
   UseMethod("indexTZ")
 }
 
+tzone <- function(x, ...) {
+  UseMethod("tzone")
+}
+
 `indexTZ<-` <- function(x, value) {
   UseMethod("indexTZ<-")
 }
 
-`indexTZ<-.xts` <- function(x, value) {
+`tzone<-` <- function(x, value) {
+  UseMethod("tzone<-")
+}
+
+`tzone<-.xts` <- `indexTZ<-.xts` <- function(x, value) {
   if( is.null(value) ) value <- ""
 
-  attr(x, ".indexTZ") <- structure(value,.Names="TZ")
+  attr(x, ".indexTZ") <- attr(x, "tzone") <- structure(value,.Names="TZ")
   attr(attr(x,"index"),"tzone") <- structure(value,.Names="TZ")
   x
 }
 
-indexTZ.default <- function(x, ...) {
+
+tzone.default <- indexTZ.default <- function(x, ...) {
   attr(x, ".indexTZ")
 }
 
-indexTZ.xts <- function(x, ...)
+tzone.xts <- indexTZ.xts <- function(x, ...)
 {
   tzone <- attr(attr(x, "index"), "tzone")
   if(is.null(tzone))
@@ -52,6 +61,8 @@
 
 check.TZ <- function(x, ...)
 {
+  #if( !getOption("xts_check_TZ", FALSE))
+  #  return()
   check <- getOption("xts_check_TZ")
   if( !is.null(check) && !check)
     return()

Modified: pkg/xts/man/indexClass.Rd
===================================================================
--- pkg/xts/man/indexClass.Rd	2012-12-29 04:30:24 UTC (rev 751)
+++ pkg/xts/man/indexClass.Rd	2013-01-15 05:05:42 UTC (rev 752)
@@ -1,8 +1,10 @@
 \name{indexClass}
 \alias{indexClass}
+\alias{tclass}
 \alias{indexFormat}
 \alias{convertIndex}
 \alias{indexClass<-}
+\alias{tclass<-}
 \alias{indexFormat<-}
 \alias{index.xts}
 \alias{index<-.xts}
@@ -35,6 +37,9 @@
 indexClass(x)
 indexClass(x) <- value
 
+tclass(x)
+tclass(x) <- value
+
 indexFormat(x)
 indexFormat(x) <- value
 

Modified: pkg/xts/man/indexTZ.Rd
===================================================================
--- pkg/xts/man/indexTZ.Rd	2012-12-29 04:30:24 UTC (rev 751)
+++ pkg/xts/man/indexTZ.Rd	2013-01-15 05:05:42 UTC (rev 752)
@@ -2,14 +2,18 @@
 \alias{TimeZone}
 \alias{indexTZ}
 \alias{indexTZ<-}
+\alias{tzone}
+\alias{tzone<-}
 \title{ Query the TimeZone of an xts object }
 \description{
 Get the TimeZone of an \code{xts} object.
 }
 \usage{
 indexTZ(x, ...)
+tzone(x, ...)
 
 indexTZ(x) <- value
+tzone(x) <- value
 }
 \arguments{
   \item{x}{ an \code{xts} object }
@@ -27,7 +31,8 @@
 removing the xts-specific attributes referenced by
 \code{indexTZ}, \code{indexFormat}, and \code{indexClass}.
 These accessor functions will continue to behave the
-same under the new internals.
+same under the new internals. Additionally, there is a new
+getter/setter method with \code{tzone} and \code{tzone<-}.
 
 Internally, all time indexing is converted to
 POSIXct, seconds since the epoch as defined
@@ -60,7 +65,7 @@
 Problems may arise when an object that had been created under
 one TZ (time zone) are used in a session using another TZ. This
 isn't usually a issue, but when it is a warning is given upon printing
-or subsetting.
+or subsetting. This warning may be controlled with \code{option("xts_check_TZ")}.
 }
 \value{
 A named vector of length one, giving the objects TZ at creation.
@@ -75,6 +80,9 @@
 \examples{
 x <- xts(1:10, Sys.Date()+1:10)
 indexTZ(x)
+
+# same, preferred as of 0.9-1
+tzone(x)
 str(x)
 x
 # now set TZ to something different...



More information about the Xts-commits mailing list