Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well there is the good old <em>Use the source, Luke!</em> --- R itself has plenty of (very efficient) C code one can study, and CRAN has hundreds of packages, some from authors you trust. That provides real, tested examples to study and adapt.</p> <p>But as Josh suspected, I lean more towards C++ and hence <a href="http://dirk.eddelbuettel.com/code/rcpp.html" rel="noreferrer">Rcpp</a>. It also has plenty of examples.</p> <p><em>Edit:</em> There were two books I found helpful:</p> <ul> <li>The first one is Venables and Ripley's "<em>S Programming</em>" even though it is getting long in the tooth (and there have been rumours of a 2nd edition for years). At the time there was simply nothing else.</li> <li>The second in Chambers' "<em>Software for Data Analysis</em>" which is much more recent and has a much nicer R-centric feel -- and two chapters on extending R. Both C and C++ get mentioned. Plus, John shreds me for what I did with <a href="http://cran.r-project.org/package=digest" rel="noreferrer">digest</a> so that alone is worth the price of admission.</li> </ul> <p>That said, John is growing fond of <a href="http://dirk.eddelbuettel.com/code/rcpp.html" rel="noreferrer">Rcpp</a> (and contributing) as he finds the match between R objects and C++ objects (via <a href="http://dirk.eddelbuettel.com/code/rcpp.html" rel="noreferrer">Rcpp</a>) to be very natural -- and ReferenceClasses help there.</p> <p><em>Edit 2:</em> With Hadley's refocussed question, I <em>very strongly</em> urge you to consider C++. There is so much boilerplate nonsense you have to do with C---very tedious and <em>very avoidable</em>. Have a look at the <a href="http://dirk.eddelbuettel.com/code/rcpp/Rcpp-introduction.pdf" rel="noreferrer">Rcpp-introduction vignette</a>. Another simple example is <a href="http://dirk.eddelbuettel.com/blog/2010/09/07#straight_curly_or_compiled" rel="noreferrer">this blog post</a> where I show that instead of worrying about 10% differences (in one of the Radford Neal examples) we can get <em>eightyfold</em> increases with C++ (on what is of course a contrived example).</p> <p><em>Edit 3:</em> There is complexity in that you may run into C++ errors that are, to put it mildly, hard to grok. But to just <em>use Rcpp</em> rather than to extend it, you should hardly ever need it. And while this <em>cost</em> is undeniable, it is far eclipsed by the <em>benefit</em> of simpler code, less boilerplate, no PROTECT/UNPROTECT, no memory management etc pp. Doug Bates just yesterday stated that he finds C++ and Rcpp to be much more like writing R than writing C++. YMMV and all that.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload