[Rcpp-devel] Integrate xts_API for C with Rcpp
Dirk Eddelbuettel
edd at debian.org
Sun Jan 13 06:10:21 CET 2013
On 12 January 2013 at 02:23, Wu Wush wrote:
| In my experience, we could write some functions based on exposed API:
| - Query a subset of xts object based on row
| subset(`Rcpp::DatetimeVector` or integer vector) and column
| subset(string vector or integer vector)
That does not necessarily need the xts API. As the data of an xts is just a
numerical matrix we can access the matrix directly -- and the index is a
vector of datetimes. I sketched something in a post on the Rcpp Gallery:
http://gallery.rcpp.org/articles/getting-attributes-for-xts-example/
| - Convert `Rcpp::Matrix<RTYPE>` instance to xts object with given
| index(`DatetimeVector`)
I think for that one most often calls back to R to invoke 'as.xts()'.
Eg that is what Rcpp itself does to create a dataframe.
| I have implemented these features, so I only need a skeleton of
| Rcpp-like package. Could you give me some suggestion about this?
You can just use any odd package generator -- eg Rcpp.package.skeleton() --
or copy and alter an existing package.
But out of curioisty, I went the other way to day today and played a little with
a basic RcppXts package to see if we could get to the exported functions of
the xts API. There are fewer than the help(xtsAPI) shows -- what really
counts is its src/init.c. If commmitted this to R-Forge as RcppXts_0.0.1 and
the basic work for me on Ubuntu. But between 32 and 64 bit Windows devel and
release, one fails cosistently (64 bit r-release).
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list