[Rcpp-commits] r4218 - in pkg/RcppXts: . man src tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 17 03:18:30 CET 2013
Author: edd
Date: 2013-01-17 03:18:29 +0100 (Thu, 17 Jan 2013)
New Revision: 4218
Modified:
pkg/RcppXts/ChangeLog
pkg/RcppXts/DESCRIPTION
pkg/RcppXts/man/RcppXts-package.Rd
pkg/RcppXts/src/xtsMod.cpp
pkg/RcppXts/tests/checks.R
Log:
Version 0.0.3 reflecting changes made in xts 0.9-1.2 and xtsAPI.h
Modified: pkg/RcppXts/ChangeLog
===================================================================
--- pkg/RcppXts/ChangeLog 2013-01-16 03:28:08 UTC (rev 4217)
+++ pkg/RcppXts/ChangeLog 2013-01-17 02:18:29 UTC (rev 4218)
@@ -1,3 +1,14 @@
+2013-01-16 Dirk Eddelbuettel <edd at debian.org>
+
+ * DESCRIPTION (Version): 0.0.3
+
+ * DESCRIPTION (Depends): Increased to xts 0.9-1.2 which new xtsAPI.h
+
+ * src/xtsMod.cpp (RCPP_MODULE): Reflect new xtsAPI.h and new function
+ names in the xts API, renamed the created R functions accordingly
+ * tests/check.R: Updated to new function names
+ * man/RcppXts-package.Rd: Idem
+
2013-01-15 Dirk Eddelbuettel <edd at debian.org>
* DESCRIPTION (Version): 0.0.2
Modified: pkg/RcppXts/DESCRIPTION
===================================================================
--- pkg/RcppXts/DESCRIPTION 2013-01-16 03:28:08 UTC (rev 4217)
+++ pkg/RcppXts/DESCRIPTION 2013-01-17 02:18:29 UTC (rev 4218)
@@ -1,7 +1,7 @@
Package: RcppXts
Type: Package
Title: Interface the xts API via Rcpp
-Version: 0.0.2
+Version: 0.0.3
Date: $Date$
Author: Dirk Eddelbuettel
Maintainer: Dirk Eddelbuettel <edd at debian.org>
@@ -11,6 +11,6 @@
In its current state, the package is mostly a proof-of-concept to support
adding useful functions, and does not yet add any of its own.
License: GPL (>= 2)
-Depends: methods, Rcpp (>= 0.10.2), xts (>= 0.9-1.1)
+Depends: methods, Rcpp (>= 0.10.2), xts (>= 0.9-1.2)
LinkingTo: Rcpp, xts
RcppModules: xts
Modified: pkg/RcppXts/man/RcppXts-package.Rd
===================================================================
--- pkg/RcppXts/man/RcppXts-package.Rd 2013-01-16 03:28:08 UTC (rev 4217)
+++ pkg/RcppXts/man/RcppXts-package.Rd 2013-01-17 02:18:29 UTC (rev 4218)
@@ -1,27 +1,35 @@
\name{RcppXts-package}
\alias{RcppXts-package}
\alias{RcppXts}
-\alias{coredata_}
-\alias{isOrdered_}
-\alias{isXts_}
-\alias{naCheck_}
-\alias{tryXts_}
+\alias{xtsIs}
+\alias{xtsIsOrdered}
+\alias{xtsNaCheck}
+\alias{xtsTry}
+\alias{xtsRbind}
+\alias{xtsCoredata}
+\alias{xtsLag}
\docType{package}
\title{Interface to the C API of xts}
\description{This package helps with an Rcpp-based interface to the API
of the \pkg{xts} package.}
\usage{
- coredata_(x)
- isOrdered_(x, increasing, strictly)
- isXts_(x)
- naCheck_(x, check)
- tryXts_(x)
+ xtsIs(x)
+ xtsIsOrdered(x, increasing, strictly)
+ xtsNaCheck(x, check)
+ xtsTry(x)
+ xtsRbind(x, y, dup)
+ xtsCoredata(x)
+ xtsLag(x, k, pad)
}
\arguments{
\item{x}{an \code{xts} object}
+ \item{y}{an \code{xts} object}
\item{increasing}{a boolean switch}
\item{strictly}{a boolean switch}
\item{check}{a boolean switch}
+ \item{dup}{a boolean switch whether to remove duplicates}
+ \item{k}{an integer denoting lag length}
+ \item{pad}{a boolean switch whether to pad}
}
\author{Dirk Eddelbuettel}
\keyword{package}
Modified: pkg/RcppXts/src/xtsMod.cpp
===================================================================
--- pkg/RcppXts/src/xtsMod.cpp 2013-01-16 03:28:08 UTC (rev 4217)
+++ pkg/RcppXts/src/xtsMod.cpp 2013-01-17 02:18:29 UTC (rev 4218)
@@ -2,7 +2,7 @@
//
// xtsMod.cpp: Rcpp R/C++ modules interface to xts
//
-// Copyright (C) 2012 Dirk Eddelbuettel
+// Copyright (C) 2013 Dirk Eddelbuettel
//
// This file is part of RcppXts.
//
@@ -25,61 +25,53 @@
// at the end of init.c in the xts sources
extern "C" {
- #define class xts_class
- #include <xts.h> // xts header
- #include <xts_stubs.c> // stubs + automatic registration -- no linking
- #undef class
-
- // We need R_GetCCallable() for the three (of six total in init.c)
- // that did not already have such a R_GetCCallable() in
- // xts_stubs.c -- currently xts_stub.c has: isXts, do_is_ordered, naCheck
-
-
+ #include <xtsAPI.h> // xts headers and exported functions
}
// wrapped so that we get a bool instead of int
-bool wrapIsXts(SEXP x) { return isXts(x); }
-bool wrapNaCheck(SEXP x, SEXP y) { return naCheck(x, y); }
+bool xtsIsWrap(SEXP x) { return xtsIs(x); }
+bool xtsNaCheckWrap(SEXP x, SEXP y) { return xtsNaCheck(x, y); }
RCPP_MODULE(xts) {
using namespace Rcpp;
- function("isOrdered_",
- &do_is_ordered,
+ function("xtsIs",
+ &xtsIsWrap, // could also wrap xts function here via &isXts
+ List::create(Named("x")),
+ "Tests whether object is of xts type");
+
+ function("xtsIsOrdered",
+ &xtsIsOrdered,
List::create(Named("x"),
Named("increasing") = true,
Named("strictly") = true),
"Tests whether object is (strictly) (increasing) ordered");
- function("isXts_",
- &wrapIsXts, // could also wrap xts function here via &isXts
- List::create(Named("x")),
- "Tests whether object is of xts type");
+ function("xtsNaCheck",
+ &xtsNaCheckWrap,
+ List::create(Named("x"),
+ Named("check") = true),
+ "Tests whether object contains non-leading NA values");
- function("tryXts_",
- &tryXts,
+
+ function("xtsTry",
+ &xtsTry,
List::create(Named("x")),
"Calls try.xts()");
- function("rbindXts_",
- &do_rbind_xts,
+ function("xtsRbind",
+ &xtsRbind,
List::create(Named("x"), Named("y"), Named("dup")),
"Combine two xts objects row-wise");
- function("naCheck_",
- &wrapNaCheck,
- List::create(Named("x"),
- Named("check") = true),
- "Tests whether object contains non-leading NA values");
-
- function("coredata_",
- &coredata_xts, // see xts's src/init.c, and above
+ function("xtsCoredata",
+ &xtsCoredata,
List::create(Named("x")),
"Extract the coredata from xts object");
- function("lagXts_",
- &lagXts,
+ function("xtsLag",
+ &xtsLag,
List::create(Named("x"), Named("k"), Named("pad")),
"Extract the coredata from xts object");
Modified: pkg/RcppXts/tests/checks.R
===================================================================
--- pkg/RcppXts/tests/checks.R 2013-01-16 03:28:08 UTC (rev 4217)
+++ pkg/RcppXts/tests/checks.R 2013-01-17 02:18:29 UTC (rev 4218)
@@ -5,11 +5,12 @@
X2 <- xts(1:4, order.by=Sys.time()+4:7)
-stopifnot( isOrdered_(X) )
-stopifnot( coredata_(X) == coredata(X) )
-stopifnot( isXts_(X) )
-stopifnot( tryXts_(as.zoo(X)) )
-rbindXts_(X, X2, FALSE)
-rbindXts_(X, X, TRUE)
-naCheck_(X)
-lagXts_(X, 2L, TRUE)
+stopifnot( xtsIsOrdered(X) )
+stopifnot( xtsCoredata(X) == coredata(X) )
+stopifnot( xtsIs(X) )
+stopifnot( all.equal(coredata(xtsTry(as.zoo(X))), coredata(X) ) )
+stopifnot( all.equal(index(xtsTry(as.zoo(X))), index(X) ) )
+xtsRbind(X, X2, FALSE)
+xtsRbind(X, X, TRUE)
+xtsNaCheck(X)
+xtsLag(X, 2L, TRUE)
More information about the Rcpp-commits
mailing list