On 6 February 2014 at 13:29, Hideyoshi Maeda wrote:
| I was aware that an xts object is just a NumericMatrix with a few attributes
and index attached, but was wondering if anybody could please give me a
walkthrough example to show me how its done with some thing that has more than
one column and also how one goes about subsetting columns of the xts
object/matrix etc.
|
| any help as always would be greatly appreciated.
i) Pass down the xts as a SEXP to your C++ function.
ii) Instantiate a NumericMatrix from the SEXP. That would be equivalent
to coredata(myXtsObject)
iii) Pick of the attribute for the time index and instantiate a
NumericMatrix. That would be equivalent to as.numeric(index(myXtsObject)
If all that fails, separate the xts in R into coredata() and index() before
passing things down, and take it from there.
You can probably also combine i) and ii), my suggestion is untested.
Dirk
--
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel