Hi I have what I think must be a really simple Rcpp question regarding treating NumericVector objects as multidimensional arrays. I can't find an answer to what might be obvious. Apologies up front if this is the case -- my inexperience with C++ is to blame...
If I use the answer posted here a (Constructing 3D array in Rcpp) as an example
library("Rcpp")
cppFunction(code='
NumericVector arrayC(NumericVector input, IntegerVector dim) {
input.attr("dim") = dim;
return input;
}
')
How do I extract/access an single slice / row / column out of the "intput" object?
I.e. Do something like
NumericMatrix X = input(_,_,i)
// FYI -- I know this doesn't work! Simply trying to convey the point...
And yes I know RcppArmadillo could be used. I have my reasons, for doing things this way but no need to bore folks with them.
Thanks.