[Rcpp-devel] Doubt about best pratices
Dirk Eddelbuettel
edd at debian.org
Sun May 1 08:05:23 CEST 2022
This is not a well-posed Rcpp question as
- matrix and data.frame are _fundamentally_ two different data types
- matrix being _one_ and only one storage type, or class, stored
as one vector with dimension attribute of size two for rows and cols;
this makes it _efficient_ and you will see a matrix type used quite a bit
in internal R functions
- data.frame being a special case of the catch-all type list with each
column being of same length but possibly different types -- and for that
reason we do not have too much tooling for this 'list of vectors' in Rcpp
besides the basics
So in short you may want to work out first what you want you algorithm to be
and maybe use higher-level converters in R to accomodate.
Dirk
--
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel
mailing list