Dear Rcpp-List:<br><br>I have been working on speeding my R code. A while ago, I realized that no further vectorization would help and interacting R with C/C++/.. was absolutely necessary. I don&#39;t program in C/C++ extensively, so the transition was a difficult process. I tried to use the R API but the error messages were intimidating. A few weeks ago I saw Professor Chambers presentation (pdf from David Smith&#39;s website) about R in Stanford. I saw him mentioning Rcpp which motivated me to try Rcpp (I confess, I am lazy to try new stuff). And I haven&#39;t been dissapointed. Thank you very much Dirk and Romain (and other developers, including Professor Chambers and Professor Bates).<br>
<br>Rcpp reduced the length of my code considerably (like: I didn&#39;t need to bother about PROTECT .. ) and the informative syntax (like: Rcpp::IntegerMatrix ..) made my code more readable. These are great advantages, but the best part was testing and compiling with the Inline package. I am a statistician; writing a C program and then using dyn.load was the way I learned to do it in grad school. Rcpp + inline makes this process way easier. <br>
<br>Thank you for the great documentation on your webpage Dirk. It helped me a lot.<br><br>I am still a beginner in using Rcpp and friends (2 weeks old) and have a few miscellaneous questions. The answer to these questions may be very basic or obvious, so please bear with me. (Dirk showed me a simple way to test things using Rcpp + inline here -- <a href="http://stats.stackexchange.com/questions/6690/what-is-the-difference-between-rf-dpois-in-rmath-h-and-the-dpois-that-i-use-direc">http://stats.stackexchange.com/questions/6690/what-is-the-difference-between-rf-dpois-in-rmath-h-and-the-dpois-that-i-use-direc</a>)<br>
<br>1. I have been using Rcpp + inline to test if the faster implementation gives the right results (which is obtained from R code). I was wondering if there are other strategies which people use to test their Rcpp code? (sorry, if this doesn&#39;t make sense.)<br>
<br>2. I have a MCMC simulation (say: foo) which uses several functions (say: fun1, fun2). These functions (fun1, fun2) are themselves computation intensive and I used Rcpp to speed them. Until now I do something like this:<br>
<br>In R file:<br><br>foo &lt;- function (...){<br><br>    src1 &lt;- paste(readLines(&quot;fun1-rcpp.cpp&quot;), collapse=&quot;\n&quot;)<br>    RcppFun1 &lt;- cxxfunction( .., plugin=&quot;Rcpp&quot;,body=src1)<br>    <br>
   ## similar cpp code for fun2<br><br>    for (i in 1:10000){<br>          ## use RcppFun1, RcppFun2 here <br>    }<br>}<br><br>I was wondering if this is OK (it already speeds up my code by zillion times) or is there a more elegant way of doing this. I am thinking about using Rcpp to increase the speed of foo (for more speed) but I am not too sure on how to do this. Towards this end, I checked a few packages mentioned on Dirk&#39;s website namely, pcaMethods. I am thinking RcppExport and .Call is the way to do this? <br>
<br>Thank you for your answers or pointers.<br><br>S.    <br>