<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">s niani</b> <span dir="ltr">&lt;<a href="mailto:riahinaini@gmail.com">riahinaini@gmail.com</a>&gt;</span><br>Date: Mon, May 30, 2011 at 9:20 AM<br>
Subject: problem with rmultinom function<br>To: <a href="mailto:rcpp-devel@lists.r-forge.r-project.org">rcpp-devel@lists.r-forge.r-project.org</a><br><br><br>Hi,<br>I sent this message a couple of days ago, but I haven&#39;t heard anything yet. I think you didnt receive it, that&#39;s why I send it again.<br>
<br>I have a strange problem that I spent several days trying to fix it, but 
unfortunately I wasn&#39;t able to catch it. I&#39;m running the rcpp code for 
3000 iterations(running the same code for 3000 times) on different 
datasets. but for some datasets, in the final iterations (like 2667 th 
iteration) the code stops running and it jumps out of the R environment.
 and if I run the same code (without any changes) on the same 
dataset(still without any changes) the problem might never happen and it
 goes to the last iteration without any problem(or the problem may occur
 in another iteration). and the interesting part is that error code is 
different each time, I got error codes like:<br>
<br>
what():  invalid partial string match<br>
what():  &#39;prob&#39; is missing<br>
what():  unused argument(s) (&lt;environment&gt;)<br>
and etc...<br>
I&#39;m pretty sure that problem occurs in the line of code that I am using 
 rmultinom function, but I included the necessary function<br>
Function rmultinom = stats[&quot;rmultinom&quot;];<br><br>to be more clear I wrote a simple function and I attached it in this email. in this code  I didn&#39;t read any dataset, I just used some variables to define the size of 
structures that I need to get from dataset. if you run the code with 
these values for P, K, unum,qnum, the error occurs in the first 10 
iterations, but If you change the values of those parameters to smaller 
values, the error may never happen.<br>
I tried to used an cpp implementation for rmultinom, it works but the program would be as slow as R version.<br><br><br>
do you have any idea why this problem occur? or did anybody ever have the same problem or can give me some tips to fix it?<br>
<br>
ps: all datasets are generated through the sampe process(with a single simulation code)<br>
<br>
Thanks<br>
</div><br>