[Rcpp-devel] Internals: how does DataFrame get initialized?

Darren Cook darren at dcook.org
Wed Feb 29 00:49:36 CET 2012


I wanted to understand what this code [1] actually does:

std::vector<double> vt, vpx, vsz;
std::vector<std::string> vsrc, vtype;
...
Rcpp::DataFrame df = Rcpp::DataFrame::create(
    Rcpp::Named("t", vt),
    Rcpp::Named("type", vtype),
    Rcpp::Named("src", vsrc),
    Rcpp::Named("px", vpx),
    Rcpp::Named("sz", vsz)
    );

Rcpp::Named(x,y) was easy [2]: it makes a little object that just stores
references to the two variables.

Understanding Rcpp::DataFrame::create() was harder [3], with 5
constructors, none of which seem like they would do the job. Can someone
give me a pointer to what I should study next.

TIA,

Darren


[1]: Extracted from:

http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-January/003345.html

[2]:
http://dirk.eddelbuettel.com/code/rcpp/html/Named_8h_source.html
http://dirk.eddelbuettel.com/code/rcpp/html/named__object_8h_source.html

[3]:
http://dirk.eddelbuettel.com/code/rcpp/html/DataFrame_8h_source.html

-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


More information about the Rcpp-devel mailing list