Re: [Rd] using R functions in a C loop

2014-07-08 Thread Sean O'Riordain
Enrico, I was in a similar position with a small likelihood function which was not vectorizable (is that a word?) and in one morning I had a working function using Rcpp which was 60 times faster than my reference function in R. I *strongly* recommend that you use C++ through the Rcpp interface whic

[Rd] using R functions in a C loop

2014-07-08 Thread Enrico Bibbona
I would like to write a fast version of a function which contains slow loops that I cannot vectorize. I would like to rewrite it in C, but in the loops I need to call a few (two) R functions. Which is the best way to do so? I have read that one can call a C library which import all the R functions