[Rcpp-devel] multidimensional arrays

Darren Cook darren at dcook.org
Fri Jun 15 16:05:21 CEST 2012


> I'm a regular user of R, but my knowledge of C++ is limited. 
> 
> I need to create functions to generate random landscapes ...This would take quite a
> long time in R so I thought it would be better to use Rcpp...

Just to add to what Steve has said: write it in R, then profile, then
just convert the slowest part to C++. That is the beauty of Rcpp/inline:
you can do it one function at a time.
(Or if you have a cluster, look at parallel R options ;-)

Also, you wrote "I need to create functions"; do you already have the R
version? If not, and given that you are an R expert, write the R version
first. Don't assume C++ will be quicker. Inexpertly written C++ can be
slower than the same code in interpreted languages.

Darren

-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


More information about the Rcpp-devel mailing list