[Rcpp-devel] rollapply

Hideyoshi Maeda hideyoshi.maeda at gmail.com
Wed Feb 26 17:23:49 CET 2014


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++?

Thanks

HLM


More information about the Rcpp-devel mailing list