[Rcpp-commits] r4375 - in pkg/RcppXts: . inst src tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 27 04:33:21 CEST 2013


Author: edd
Date: 2013-06-27 04:33:20 +0200 (Thu, 27 Jun 2013)
New Revision: 4375

Modified:
   pkg/RcppXts/ChangeLog
   pkg/RcppXts/inst/NEWS.Rd
   pkg/RcppXts/src/xtsMod.cpp
   pkg/RcppXts/tests/checks.R
Log:
* src/xtsMod.cpp: Added a more functions now that xts 0.9-5 is on CRAN
* tests/check.R: Added some illustrations / tests as well


Modified: pkg/RcppXts/ChangeLog
===================================================================
--- pkg/RcppXts/ChangeLog	2013-06-25 13:47:06 UTC (rev 4374)
+++ pkg/RcppXts/ChangeLog	2013-06-27 02:33:20 UTC (rev 4375)
@@ -1,3 +1,8 @@
+2013-06-26  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/xtsMod.cpp: Added a more functions now that xts 0.9-5 is on CRAN
+	* tests/check.R: Added some illustrations / tests as well
+
 2013-01-18  Dirk Eddelbuettel  <edd at debian.org>
 
 	* DESCRIPTION (Version): 0.0.4

Modified: pkg/RcppXts/inst/NEWS.Rd
===================================================================
--- pkg/RcppXts/inst/NEWS.Rd	2013-06-25 13:47:06 UTC (rev 4374)
+++ pkg/RcppXts/inst/NEWS.Rd	2013-06-27 02:33:20 UTC (rev 4375)
@@ -2,9 +2,16 @@
 \title{News for Package \pkg{RcppXts}}
 \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
 
+\section{Changes in version 0.0.5 (2013-xx-yy)}{
+  \itemize{
+    \item Depends on \cpkg{xts} 0.9-5 now on CRAN
+    \item Exports a number of additional functions
+  }
+}
+
 \section{Changes in version 0.0.4 (2013-01-18)}{
   \itemize{
-    \item Depends on (unreleased) \cpkg{xts} 0.9-2 now on CRAN
+    \item Depends on \cpkg{xts} 0.9-2 now on CRAN
   }
 }
 

Modified: pkg/RcppXts/src/xtsMod.cpp
===================================================================
--- pkg/RcppXts/src/xtsMod.cpp	2013-06-25 13:47:06 UTC (rev 4374)
+++ pkg/RcppXts/src/xtsMod.cpp	2013-06-27 02:33:20 UTC (rev 4375)
@@ -70,4 +70,37 @@
              List::create(Named("x"), Named("k"), Named("pad")),
              "Extract the coredata from xts object");
 
+    function("xtsMakeIndexUnique",
+             &xtsMakeIndexUnique,
+             List::create(Named("x"), Named("eps")),
+             "Make the POSIXt index unique by separating by 'eps'");
+    
+    function("xtsMakeUnique",
+             &xtsMakeIndexUnique,
+             List::create(Named("x"), Named("eps")),
+             "Make the POSIXt index unique by separating by 'eps'");
+
+    function("xtsEndpoints",
+             &xtsEndpoints,
+             List::create(Named("x"), Named("on"), Named("k"), Named("addlast")),
+             "Create a series of end points given a time index");
+
+    function("xtsMerge",
+             &xtsMerge,
+             List::create(Named("x"), Named("y"), Named("all"), Named("fill"), Named("retclass"),
+                          Named("colnames"), Named("suffixes"), Named("retside"),
+                          Named("env"), Named("coerce")),
+             "Merge two series");
+
+    function("xtsNaOmit",
+             &xtsNaOmit,
+             List::create(Named("x")),
+             "Omit NA values");
+
+    // -- this requires xts 0.9-6 or later (fixed in SVN)
+    // function("xtsNaLocf",
+    //          &xtsNaLocf,
+    //          List::create(Named("x"), Named("fromLast"), Named("maxgap"), Named("limit")),
+    //          "Fill NA values by carrying last observation forward");
+
 }

Modified: pkg/RcppXts/tests/checks.R
===================================================================
--- pkg/RcppXts/tests/checks.R	2013-06-25 13:47:06 UTC (rev 4374)
+++ pkg/RcppXts/tests/checks.R	2013-06-27 02:33:20 UTC (rev 4375)
@@ -1,6 +1,8 @@
 
 library(RcppXts)
 
+options("digits.secs"=6)
+
 X  <- xts(1:4, order.by=Sys.time()+0:3)
 X2 <- xts(1:4, order.by=Sys.time()+4:7)
 
@@ -13,4 +15,30 @@
 xtsRbind(X, X2, FALSE)
 xtsRbind(X, X, TRUE)
 xtsNaCheck(X)
-xtsLag(X, 2L, TRUE)
+Y <- X
+xtsLag(Y, 2L, TRUE)
+
+Y <- X
+index(Y)[2] <- index(Y)[3]
+Y
+xtsMakeIndexUnique(Y, 0.001)
+
+Y <- X
+index(Y)[2] <- index(Y)[3]
+xtsMakeUnique(Y, 0.5)
+
+X  <- xts(1:20, order.by=Sys.time()+(0:19)*60)
+xtsEndpoints(index(X), 60L, 4, TRUE)     # every fourth minute, incl last
+xtsEndpoints(index(X), 60L, 4, FALSE)    # every fourth minute
+
+xtsMerge(X, X2, c(TRUE,TRUE), TRUE, TRUE, "a", "b", TRUE, new.env(), 0)
+
+Y2 <- Y
+Y2[2] <- NA
+xtsNaOmit(Y2)
+
+## -- requires xts 0.9-6 (fixed in SVN)
+## Y2 <- X2
+## Y2[3] <- NA
+## Y2
+## xtsNaLocf(Y2, FALSE, 1, Inf)



More information about the Rcpp-commits mailing list