[Rcpp-devel] Copy rownames and colnames from a NumericMatrix to another NumericMatrix
Florian Plaza Oñate
florian.plaza at jouy.inra.fr
Tue Aug 11 12:30:50 CEST 2015
Hi everyone,
I am trying to copy the rownames and the colnames from a NumericMatrix
to another NumericMatrix by using Rcpp
Here is my code:
Rcpp::NumericMatrix copy(const Rcpp::NumericMatrix& m)
{
Rcpp::NumericMatrix m2(num_genes, num_samples);
Rcpp::rownames(m2) = Rcpp::rownames(m);
Rcpp::colnames(m2) = Rcpp::colnames(m);
return m2;
}
It does change the default rownames and colnames of the NumericMatrix.
Do you know how to do it?
Thanks in advance.
More information about the Rcpp-devel
mailing list