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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Oct 6 13:52:44 CEST 2012


Author: braverock
Date: 2012-10-06 13:52:43 +0200 (Sat, 06 Oct 2012)
New Revision: 732

Modified:
   pkg/xts/DESCRIPTION
   pkg/xts/NAMESPACE
   pkg/xts/R/Math.xts.R
Log:
- add and S3method mean.xts and sd.xts
- bump version


Modified: pkg/xts/DESCRIPTION
===================================================================
--- pkg/xts/DESCRIPTION	2012-09-27 16:38:43 UTC (rev 731)
+++ pkg/xts/DESCRIPTION	2012-10-06 11:52:43 UTC (rev 732)
@@ -1,8 +1,8 @@
 Package: xts
 Type: Package
 Title: eXtensible Time Series
-Version: 0.8-7
-Date: 2012-03-23
+Version: 0.8-7.1
+Date: 2012-10-05
 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-09-27 16:38:43 UTC (rev 731)
+++ pkg/xts/NAMESPACE	2012-10-06 11:52:43 UTC (rev 732)
@@ -141,6 +141,11 @@
 S3method(is.time.unique, xts)
 S3method(is.time.unique, zoo)
 
+S3method(mean,xts)
+S3method(sd,xts)
+
+#S3method(rollapply,xts)
+
 # xts methods
 importFrom(zoo,coredata)
 importFrom(zoo, index)

Modified: pkg/xts/R/Math.xts.R
===================================================================
--- pkg/xts/R/Math.xts.R	2012-09-27 16:38:43 UTC (rev 731)
+++ pkg/xts/R/Math.xts.R	2012-10-06 11:52:43 UTC (rev 732)
@@ -51,3 +51,17 @@
   } else x[] <- apply(coredata(x), 2, function(y) cummax(y))
   x
 }
+
+mean.xts <- function(x,...) {
+    if(is.vector(x) ||is.null(ncol(x))  || ncol(x)==1){
+        x<-as.numeric(x)
+        mean(x,...)
+    } else apply(x,2,mean.xts,...)
+} 
+
+sd.xts <- function(x,na.rm=FALSE) {
+    if(is.vector(x) || is.null(ncol(x)) || ncol(x)==1){
+        x<-as.numeric(x)
+        sd(x,na.rm=na.rm)
+    } else apply(x,2,sd,na.rm=na.rm)
+}
\ No newline at end of file



More information about the Xts-commits mailing list