[Rcpp-devel] sending 3D object to R

Dirk Eddelbuettel edd at debian.org
Mon Nov 14 20:53:00 CET 2016


On 14 November 2016 at 14:27, Anon User wrote:
| Hi, I am trying to send a 3 dimensional object from C++ to R as an R array. I don’t know how to construct an R array in C++ using Rcpp.  I am hoping to look at an example from one of the CRAN packages that use Rcpp.  Can anyone recommend a package that I should look into?

The unit test files are a first stop -- look at both

    inst/unitTests/runit.Vector.R
    inst/unitTests/cpp/Vector.cpp

This can be as simple as

// [[Rcpp::export]]
IntegerVector integer_dimension_ctor_3(){
    return IntegerVector( Dimension( 2, 3, 4) ) ;
}


Dirk

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


More information about the Rcpp-devel mailing list