[Rcpp-devel] List of matrices mimicking 3d array?

Hadley Wickham hadley at rice.edu
Thu Jan 5 02:11:49 CET 2012


> Our arrays in Rcpp can be multidimensional just like they can in R. Here is a
> line from one of the unit tests:
>
>   return IntegerVector( Dimension( 2, 3, 4) ) ;
>
> which sets the dim attribute of a given vector to c(2,3,4) just like you
> would in R.  That should all work too but may have seen less exposure than
> other parts of our code.

Am I reading the Vector documentation correctly
(http://dirk.eddelbuettel.com/code/rcpp/html/classVector.html) in
interpreting that while you can create vectors with dimensions, that
there is no syntactic sugar for  multidimensional indexing?  I'm not
quite sure how to interpret method signatures like operator() (const
size_t &i, const size_t &j) const. I can guess that means you can
index by two integers - but I don't know what those two integers mean.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/


More information about the Rcpp-devel mailing list