[Rcpp-devel] Basic documentation for Rcpp

Nick Sabbe nick.sabbe at ugent.be
Fri May 13 15:02:42 CEST 2011

Hello all.

Today, I posted a question on stackoverflow.com, but I was advised to ask
the question through this mailing list.


So, here is the verbatim question from SO


I want to look into rcpp to improve the speed of some of my R code without
having to resort to messy C++ code (I've had some success with that, but it
looks like code from hell).

So, I checked the documentation provided with Rcpp, and also the bundle of
documents provided at  <http://dirk.eddelbuettel.com/code/rcpp.html> Dirk
Eddelbuettel's site. I installed and looked at RcppExamples, but (at least
from its documentation) most of these refer to RcppClassic?. Besides that, I
did some googling but that didn't result in answers to what seem like basic

.         Do indexes in Rcpp work zero-based or one-based

.         List provides both operator() and operator[], but apparently not
operator[[]]. It is not clear which ones are similar to [] and [[]] in R.

.         Is there any support for factors in Rcpp (there does not appear to
be any)?

Note: in fact I found some answers from the first example in
Rcpp-introduction.pdf, but that just felt like luck.

Also, my stl is very rusty, so if anybody can provide me with a simple
example where each element of a List is (e.g.) print-ed with an stl-style
loop, that would be neat.

If anybody wants to call me an idiot for not finding this information: go
ahead and make your day. Then make mine and point me to the docs I need :-)

As a suggestions to Mr. Eddelbuettel and other Rcpp authors (I expect some
of them to read this): the class hierarchies and the like, provided by
doxygen, are really neat when you are already kneedeep into Rcpp, but for a
beginner (in Rcpp), I am more interested in a list of 'this method in this
class does this like that function in R' rather than 'you can find the
declaration of this operator in this header file'. After all, I understand
one of the goals of Rcpp is to lower the threshold for using C++ in R? Note:
from what I have seen and understood, I highly value the actual code of Rcpp
and have the highest respect for its creators. If the lack of basic
documentation is merely a result of 'lack of resources', I would be willing
to become a resource (e.g.: work on 'basic' documentation once I get through
it myself).



Nick Sabbe


ping: nick.sabbe at ugent.be

link:  <http://biomath.ugent.be/> http://biomath.ugent.be

wink: A1.056, Coupure Links 653, 9000 Gent

ring: 09/264.59.36


-- Do Not Disapprove


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110513/32b8c1cc/attachment.htm>

More information about the Rcpp-devel mailing list