[Rcpp-devel] Getting names

David Edwards David.Edwards at agrsci.dk
Tue Mar 25 10:45:20 CET 2014


Another novice question: the function

// [[Rcpp::export]]
IntegerVector maketable(IntegerVector x) {
  IntegerVector tab=table(x);
  return tab;
}

returns a named vector, and is about twice as fast as the R function 'table'. Is there a way to extract the names of the vector as a CharacterVector (or even better here, as an IntegerVector)?

BR David


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140325/efe7ab07/attachment-0001.html>


More information about the Rcpp-devel mailing list