On 26 February 2014 at 16:23, Hideyoshi Maeda wrote:
| Hi Rcpp devel list,
| 
| One of the functions I like to use is zoo’s rollapply() function. However 
sometimes this can be slow as it is basically a long loop using mapply.
| 
| Given how fast loops are in C++ this seems like this would be the perfect 
thing to covert into C++, BUT, one of the benefits of rollapply, is that it is 
flexible and you can put in any R custom function you like. I think there are 
some functionality in Rcpp that allow you to carry out custom R functions, but 
not sure what it is or if it would be helpful as you might have to recursively 
keep calling R each time it need the custom function in the loop.
| 
| So I guess my question is 1) is there an existing implementation that has 
converted rollapply to C++ and 2) if not, then given the desired flexibility of 
using custom functions in rollapply, would converting it into C++ code be 
worthwhile? 3) if it would be worthwhile, then what should I be researching to 
be able to get custom functions into Rcpp/C++?

Have you looked at RcppRoll yet?  See

   http://cran.r-project.org/web/packages/RcppRoll/index.html

Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to