[Rcpp-devel] DataFrame::create() in endless loop

Dirk Eddelbuettel edd at debian.org
Tue Feb 28 17:51:47 CET 2012

On 28 February 2012 at 17:16, Steffen Neumann wrote:
| Hi,
| I am currently hunting a problem where a call to 
| Rcpp::DataFrame::create() goes into a seemingly 
| endless loop. seqNum,acquisitionNum and msLevel
| are all std::vector<int> of length N (~3.9 million),
| and if I change the code to only include seqNum,acquisitionNum
| this runs fine. msLevel contains values \in {0,1}.
| I am currently on R-devel (2012-01-16 r58124) x86_64-unknown-linux-gnu
| using Rcpp_0.9.7. I've added a gdb stack trace at the end,

We suggest that you upgrade to 0.9.10.

| although most useful information seems to have been optimized away :-(
| Any ideas what to check next ? Try a new Rcpp ? 

I would always work with small reproducible examples, and try to solve it on
those first. 

Doug suggested to create an Rcpp::IntegerVector object first which may help.
But in general, the implicit 'Rcpp::wrap()' of an STL object should also work
(and is a very nice feature to have).

You could also try Rcpp::List instead of Rcpp::DataFrame -- while they are
similar, Lists are just a little bit simpler.

Worst case, try objects half the size :-/


| Yours,
| Steffen
|      std::vector<int> seqNum(N); 
|      std::vector<int> acquisitionNum(N);
|      std::vector<int> msLevel(N);
|      // works:	
|      allScanHeaderInfo = Rcpp::DataFrame::create( Rcpp::_["seqNum"]                   = seqNum,
| 						  Rcpp::_["acquisitionNum"]           = acquisitionNum)
|      // endless (?) loop
|      allScanHeaderInfo = Rcpp::DataFrame::create( Rcpp::_["seqNum"]                   = seqNum,
| 						  Rcpp::_["acquisitionNum"]           = acquisitionNum,
| 						  Rcpp::_["msLevel"]                  = msLevel)

"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

More information about the Rcpp-devel mailing list