Hi Kevin, Thanks. I will give the GitHub version a try -- the error usually manifests only after running for about a day or so, so it may take a while to do that. Unfortunately I am having trouble creating a small reproducible example -- a function with just the assignments as written in my previous e-mail works fine when executed thousands of times in a loop. The full code is not that long (~165 lines), but is also non-trivial.
It's odd that something else is causing things to fail with the end result being that only the field *names*, which are hardcoded, and not the values, not coming through properly. Since you said you suspect the problem may be fixed, can you give me a hint of what you think it may be related to? This might help me isolate the piece of offending code. On Tue, May 27, 2014 at 5:46 PM, Kevin Ushey <[email protected]> wrote: > Hi John, > > I think we may have tackled this in some of the latest fixes with the > version of Rcpp on GitHub. Can you try installing that version and > trying again? Ie, try > > install.packages(devtools); devtools::install_github("RcppCore/Rcpp") > > then try running your code again. > > Alternatively, please supply a small reproducible example that we can > try to run ourselves. You may be able to tease this error out > reproducibly if you run it with gctorture(TRUE) on. > > Thanks, > Kevin > > On Tue, May 27, 2014 at 2:42 PM, John Mous <[email protected]> wrote: > > Hello, > > > > I am passing back a very simple std::map<std::string, int> from Rcpp as > > follows: > > > > std::map<std::string, int> result; > > result["X1"] = X1; > > result["X2"] = X2; > > result["X3"] = X3; > > result["X4"] = X4; > > return wrap(result); > > > > 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: > > > > Browse[1]> results > > [1] 1 2 863 0 > > Error during wrapup: 'getCharCE' must be called on a CHARSXP > > Browse[1]> str(results) > > atomic [1:4] 1 2 863 0 > > - attr(*, "")= symbol X1 > > - attr(*, "")= language `[[<-`(`*tmp*`, sim, value = 1L) > > > > results[[X1]] works, but results[["X1"]] does not, and X2-X4 can be > > retrieved only by index. However, again, most runs are successful: > > > > Browse[1]> results > > X1 X2 X3 X4 > > 1 1 3254 0 > > Browse[1]> str(results) > > Named int [1:4] 1 1 3254 0 > > - attr(*, "names")= chr [1:4] "X1" "X2" "X3" "X4" > > > > > > 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? > > > > Thank you. > > > > _______________________________________________ > > Rcpp-devel mailing list > > [email protected] > > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel >
_______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
