<div dir="ltr"><div><div><div><div>Hello,<br><br>I am passing back a very simple std::map<std::string, int> from Rcpp as follows:<br><br>std::map<std::string, int> result;<br>result["X1"] = X1;<br>result["X2"] = X2;<br>
result["X3"] = X3;<br>result["X4"] = X4;<br>return wrap(result);<br><br></div>The keys are hardcoded as shown, and the values X1-X4 are ints. Almost always everything works fine, however, very intermittently, a vector is returned on the R side _without_ named fields. For example:<br>
<br>Browse[1]> results<br>[1]   1   2 863   0<br>Error during wrapup: 'getCharCE' must be called on a CHARSXP<br>Browse[1]> str(results)<br> atomic [1:4] 1 2 863 0<br> - attr(*, "")= symbol X1<br> - attr(*, "")= language `[[<-`(`*tmp*`, sim, value = 1L)<br>
<br></div>results[[X1]] works, but results[["X1"]] does not, and X2-X4 can be retrieved only by index. However, again, most runs are successful:<br><br>Browse[1]> results<br> X1  X2  X3  X4 <br>   1    1 3254    0 <br>
Browse[1]> str(results)<br> Named int [1:4] 1 1 3254 0<br> - attr(*, "names")= chr [1:4] "X1" "X2" "X3" "X4"<br><br><br></div>I am using R 3.1.0 and Rcpp 0.11.1. Does the message "Error during wrapup: 'getCharCE' must be called on a CHARSXP" within this context hint anything to anyone familiar with Rcpp's internals? I realize it's almost impossible to diagnose with the given information -- is there a way to get Rcpp to display more debugging information?<br>
<br></div>Thank you.<br></div>