Hi Frederico, On Fri, Jun 15, 2012 at 5:27 AM, Frederico Mestre <mestre.freder...@gmail.com> wrote: > Hello all: > > I’m a regular user of R, but my knowledge of C++ is limited. > > I need to create functions to generate random landscapes (with two habitat > classes) based on area and distance amongst patches. This would take quite a > long time in R so I thought it would be better to use Rcpp (which seems a > simpler way to integrate R and C++). I need to generate these landscapes for > the current time and their evolution in the future (about 1000 to each of > these time steps). > I thought it would be better to generate these “landscapes” as > multidimensional arrays but I’m finding it hard to work with C++. > > Would it be adequate to use this functions: > > rdlandscape <- cxxfunction(signature(x = "numeric"), body = "C++ code", > plugin="Rcpp") > > I don’t need to retain these objects after the run just calculate several > parameters (as extinction probability) of a species that would be present in > these landscapes. > > Any ideas?
It's hard to provide any ideas -- you're giving us very little to work with. We're not sure (at least I'm not) what exactly you're trying to do, so I'll take it as truth that generating these in R will result in prohibitively long running time, in this case looking to Rcpp is a great idea -- yes, it makes integrating C++ w/ R much easier. But what type of ideas are you looking to get here -- assuming you substitute the correct C++ code in your `body="C++ code", then you'll be a happy camper ... the trick is getting the right code in there. Also, once you do get the right code, you probably want to turn this stuff into a package so you don't have to inline/compile it every time you start a new R session. People can provide more help when you start implementing these thing and run into a particular wall with Rcpp itself. At that point, please provide a better description of what you're trying to do, what you've actually tried, and where the exact problem is. Until then, there isn't much else we can do for you now. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact _______________________________________________ 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