[Rcpp-devel] Favourite Rcpp examples for newbies ?

Wush Wu wush978 at gmail.com
Thu Aug 1 18:27:29 CEST 2013


For me, there are two reasons to learn Rcpp:

1. Rcpp provides a straightforward way to speed up existed R script.

I answered 2 question of speeding up R code on StackOverflow with Rcpp:

http://stackoverflow.com/questions/14495697/speeding-up-a-repeated-function-call/14495967#14495967

For this question, Rcpp is 140 times faster.

http://stackoverflow.com/questions/14494964/how-to-find-nearby-integers-efficiently/14496071#14496071

For this question, Rcpp is 7x times faster.

The Rcpp way to speed up R code is so straightforward: re-implement the
algorithm in C++ whose syntax is similar to R based on Rcpp. On the other
hand, the R way to speed up R script requires sophisticated knowledge of R.

2. Rcpp makes it easy to integrate the existed C++/C library into R.
Therefore, I could use more widely existed resources in my work.

Last year, we wrote a paper in only 1 month which proposed a very fast
algorithm to find all unique substring in a long string. The algorithm was
based on suffix tree, and I failed to find a package of suffix tree in R.
(I notice that there is a package named Rlibstree in bioconductor) I found
one library in C and exposed it quickly into R with Rcpp Module.

We release our code here: https://bitbucket.org/wush_iis/rsus

Rhiredis is another example.

---

Hope it helps.


2013/8/1 Dirk Eddelbuettel <edd at debian.org>

>
> I'm giving a talk to the Chicago RUG that is limited to 30 mins, and I
> would
> like to include some nice examples (besides standards like Fibonacci and
> SimulatingPi).  The other talk is on ggplot(2), so the house may be full
> with
> new users / non-C++ hackers.
>
> What examples should I talk about?  Bonus points for links for list
> questions, StackOverflow questions, or Rcpp Gallery posts.
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130802/b308c096/attachment.html>


More information about the Rcpp-devel mailing list