[Rcpp-devel] Integrate xts_API for C with Rcpp

Dirk Eddelbuettel edd at debian.org
Sun Jan 13 15:36:04 CET 2013


On 13 January 2013 at 08:13, Jeff Ryan wrote:
| Nice work.  I'll be frank, I am not overly interested in this from a practical
| standpoint myself, since it doesn't solve a near term problem for me - not
| being a C++ guy and all and being perfectly at home in the R API.

That's ok. All an external package needs from you are stable interfaces (a
given) that are also declared in init.c and can hence be accessed from other
R package using the function pointer dereferencing you yourself use from zoo.

I think you and can hash out the issues I already signaled in off-line mail
and then maybe see if there are a handful of additional useful functions. 

Ultimately, I think xts draws much of its (awesome) power from how you mix R
and C, and we won't be able to fully replicate that coming from the C API
side only. Yet that being said, there may be good usecase for basic
subsetting, merging, expanding,... from the C API side.
 
| But, I will certainly add the needed init.c stuff and help facilitate where I
| can.

Sounds good.

Dirk
 
| Cool stuff.
| Jeff
| 
| 
| On Sat, Jan 12, 2013 at 11:10 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| 
| 
|     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
| 
| 
| 
| 
| --
| Jeffrey Ryan
| jeffrey.ryan at lemnica.com
| 
| www.lemnica.com

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list