Romain Francois, Professional R Enthusiast

To content | To menu | To search

Wednesday, March 30 2011

Rcpp workshop in Chicago on April 28th


This year's R/Finance conference will be preceded by a full-day masterclass on Rcpp and related topics which will be held on Thursday, April 28, 2011, the Univ. of Illinois at Chicago campus.

Join Dirk Eddelbuettel and Romain Francois for six hours of detailed and hands-on instructions and discussions around Rcpp, inline, RInside, RcppArmadillo and other packages---in intimate small-group setting.

The full-day format allows to combine a morning introductory session with a more advanced afternoon session while leaving room for sufficient breaks. There will be about six hours of instructions, a one-hour lunch break and two half-hour coffee breaks.

Morning session: "A hands-on introduction to R and C++"

The morning session will provide a practical introduction to the Rcpp package (and other related packages). The focus will be on simple and straightforward applications of Rcpp in order to extend R and/or to significantly accelerate the execution of simple functions.

The tutorial will cover the inline package which permits embedding of self-contained C, C++ or Fortran code in R scripts. We will also discuss RInside to embed R code in C++ applications, as well as standard Rcpp extension packages such as RcppArmadillo for linear algebra and RcppGSL.

Afternoon session: "Advanced R and C++ topics"

This afternoon tutorial will provide a hands-on introduction to more advanced Rcpp features. It will cover topics such as writing packages that use Rcpp, how 'Rcpp modules' and the new R ReferenceClasses interact, and how 'Rcpp sugar' lets us write C++ code that is often as expressive as R code. Another possible topic, time permitting, may be writing glue code to extend Rcpp to other C++ projects.

We also hope to leave some time to discuss problems brought by the class participants.


Knowledge of R as well as general programming knowledge; C or C++ knowledge is helpful but not required.

Users should bring a laptop set up so that R packages can be built. That means on Windows, Rtools needs to be present and working, and on OS X the Xcode package should be installed.


Registration is available via the R/Finance conference at

or directly at RegOnline

The cost is USD 500 for the whole day, and space will be limited.


Please contact us directly at

Thursday, March 3 2011

Eponyme : 40 minutes stand up

I'll play my 40 minutes one man show in Montpellier on March 15th, and a small extract at the next Montpellier Comédie Club next wednesday


Wednesday, March 2 2011

Rcpp at Geneva-R

I'll present Rcpp at the inaugural Geneva-R meeting.

Geneva-R is an informal gathering of R enthusiasts sponsored by Mango Solutions, that builds on the success of London-R, where I presented twice, and Basel-R

Friday, January 28 2011

Facebook me, I'm famous

After years of resistance, here I am on facebook

Tuesday, January 18 2011

Back to Stand-Up

This is I guess off topic in this blog, but after a few years off, I'm back on stage doing some stand up comedy, as part of the Montpellier Comédie Club

See me on youtube:

Some press coverage and pictures: soonlight le-macadam-303380_0.jpg le-macadam-303380_1.jpg le-macadam-303380_12.jpg le-macadam-303380_13.jpg

Local news report (France 3 Montpellier)

Tuesday, December 7 2010

highlight 0.2-5

I pushed highlight 0.2-5 on CRAN. This release improves the latex renderer and the sweave driver so that multiple lines character strings are properly rendered.

This example vignette shows it:


old.op <- options( prompt = " ", continue = " " )

require( inline )
require( Rcpp )
convolve <- cxxfunction( 
    signature( a = "numeric", b = "numeric" ), '
    NumericVector xa(a); int n_xa = xa.size() ;
    NumericVector xb(b); int n_xb = xb.size() ;
    NumericVector xab(n_xa + n_xb - 1,0.0);
    Range r( 0, n_xb-1 );
    for(int i=0; i<n_xa; i++, r++){
        xab[ r ] += noNA(xa[i]) * noNA(xb) ;
    return xab ;
', plugin = "Rcpp" )
convolve( 1:4, 1:5 )

options( old.op )


Once processed with Sweave, e.g. :

require( highlight )
driver <- HighlightWeaveLatex(boxes = TRUE)
Sweave( 'test.Rnw', driver = driver )
texi2dvi( 'test.tex', pdf = TRUE )

we get this result, embedded below with google viewer:

See this question on stack overflow for the tip of using google documents to display pdf files

Friday, December 3 2010

Evolution of Rcpp code size

I've been contributing to Rcpp for about a year now, initially to add missing bits that were needed for the development of RProtoBuf. This led to a complete redesign of the API, which now goes way beyond the initial code (that we now call classic Rcpp API). This has been quite a journey in terms of development with more than 1500 commits to the svn repository of the project on R-forge, and promotion with presentations at RMetrics 2010, useR 2010, LondonR and at Google, as well as many blog posts about Rcpp and the packages that derive from it.

I wanted to take this opportunity to express visually how vibrant the development of Rcpp has been since it was first relaunched in 2008, and since I started to contribute.

The graph below shows the evolution of the number of lines (counting the .h, .cpp, .R, .Rd, .Rnw files) accross released versions of the Rcpp package on CRAN

The first thing I need for this is to download the 32 versions of Rcpp that have been released since 0.6.0.

Then, all it takes is some processing with R to extract the relevant information (number of lines in files of interest), and present the data in a graph. I'm also taking this opportunity to have some fun with raster images and the png package


The code explosion that started around version 0.7.8 marks the beginning of development of two of the most exciting and addictive projects I ever worked on: modules and sugar

The acceleration between 0.8.8 and the current version 0.8.9 represents many of the improvements that were made in modules. That alone, with more than 8000 new lines of code and documentation represents about 4 times as many lines as the total number of lines in 0.6.0

We still have plenty of ideas, and Rcpp will continue to evolve to deliver a quality interface between R and C++, to the best of the current team's abilities.

The full code is available below:

Wednesday, December 1 2010

RcppGSL 0.1.0


We released the first version of our RcppGSL package. RcppGSL extends Rcpp to help programmers code with the GNU Scientific Library (GSL).

The package contains template classes in the RcppGSL namespace that act as smart pointers to the associated GSL data structure. For example, a RcppGSL::vector<:double> object acts a smart pointer to a gsl_vector*. Having the pointer shadowed by a smart pointer allows us to take advantage of C++ features such as operator overloading, etc ... which for example allows us to extract an element from the GSL vector simply using [] instead of GSL functions gsl_vector_get and gsl_vector_set

The package contains a 11 pages vignette that explains the features in details, with examples. The vignette also discusses how to actually use RcppGSL, either in another package (preferred) or directly from the R prompt through the inline package.

Sunday, November 28 2010

parser 0.0-13

I've pushed a new version of the parser package to CRAN.

This is the first release that depends on Rcpp, which allowed me to reduce the code size and increase its maintainability.

This also features a faster version of nlines, a function that retrieves the number of lines of a text file.

Rcpp 0.8.9

Rcpp 0.8.9 was pushed to CRAN recently. Apart from minor bug fixes, this release concentrates on modules, with lots of new features to expose C++ functions and classes through R reference classes.

Apollo 17 Command Module

The Rcpp-modules vignette has all the details

The major points are highlighted in the NEWS entry below:

0.8.9   2010-11-28 (or even -27)

    o   Many improvements were made to in 'Rcpp modules':

        - exposing multiple constructors

        - overloaded methods

        - self-documentation of classes, methods, constructors, fields and 

        - new R function "populate" to facilitate working with modules in 

        - formal argument specification of functions.

        - updated support for Rcpp.package.skeleton.

        - constructors can now take many more arguments.
    o   The 'Rcpp-modules' vignette was updated as well and describe many
        of the new features

    o   New template class Rcpp::SubMatrix and support syntax in Matrix
        to extract a submatrix: 
           NumericMatrix x = ... ;
           // extract the first three columns
           SubMatrix y = x( _ , Range(0,2) ) ; 
           // extract the first three rows
           SubMatrix y = x( Range(0,2), _ ) ; 
           // extract the top 3x3 sub matrix
           SubMatrix y = x( Range(0,2), Range(0,2) ) ; 

    o   Reference Classes no longer require a default constructor for
        subclasses of C++ classes    

    o   Consistently revert to using backticks rather than shell expansion
        to compute library file location when building packages against Rcpp
	on the default platforms; this has been applied to internal test
        packages as well as CRAN/BioC packages using Rcpp

Saturday, November 13 2010

ZAT! 2010

Tomorrow is the last day to enjoy the first edition of Montpellier's ZAT! (Zones Artistiques Temporaires). I was there this afternoon and tonight, but I found it much more picture worthy tonight:

Other people have also taken pictures and shared them on flickr:

Friday, November 12 2010

What would impressionnists do with R ?

I've been playing with images recently, probably inspired from my trip in San Francisco. There was an exhibit at the De Young museum of fine arts with pieces borrowed from the Musée d'Orsay. I did not go to the exhibit because it is easy enough for me to just go to Paris and the Musée d'Orsay, but I guess this somewhat inspired me, along with the golden gate bridge, to do some R based impressionnism

The starting point is this picture of the golden gate bridge


The png package makes it straightforward to import png pictures into R (There are other ways as well).

Then, I generate randomly spaced circles so that they don't overlap, and fill each circle with the average color (on the RGB space) of all te pixels that are inside the circle

circles-1.png circles-2.png
circles-3.png circles-4.png

Then I do this many times, with translucent circles, and after some iterations ,the golden gate bridge starts to reveal itself


The code for this is included below

Here are other examples



Thursday, October 28 2010

Google tech talk / Rcpp, ... presentation on youtube

Following this post, the 90 minutes presentation is now available to watch on youtube:

Saturday, October 23 2010

Google slides

Last stop on my World tour was Google headquarters in Mountain View, California, where Dirk and I presented Rcpp, RInside, RProtoBuf, etc ... for 90 minutes today. The talk was recorded, and will be broadcasted on youtube at some point. In the meantime, the slides are available here:

Thursday, October 21 2010

Chicago R Meetup slides

Second stop of my world tour was chicago yesterday night, where I presented a quick light review of various ways to represent objects in R: lexical scoping, S3, S4, the new reference classes and also with C++ using Rcpp modules or RProtoBuf

My slides are on my slideshare account:

Thursday, October 7 2010

LondonR Rcpp slides

I'm just back to london where I presented about Rcpp at mango's LondonR event.

This was the third time (after rmetrics and useR!) I presented these slides, so I allowed myself some new metaphores about my long term relationship with R and my indiscretions with other languages such as C++. I've uploaded my slides to my slideshare account:

I had some time to browse around in South Bank and Covent Garden before the event. I took some pictures from my iphone

Friday, September 10 2010

Rcpp 0.8.6

Dirk released Rcpp 0.8.6 to CRAN

Most of the development of this release was trigerred by a question on the Rcpp-devel mailing list. After Richard's question, we added d-p-q-r functions for most of the distributions available in R.

The file runit.stats.R contains several examples of using them.

We have also started developing Rcpp 0.8.7, which will depend on the next version of R (R 2.12.0) since it will use some of the features it will introduce. More on this later...

Dirk also blogged about the release, including the relevant NEWS extract.

Friday, August 13 2010

Rcpp svn revision 2000

I commited the 2000th revision of Rcpp svn today, so I wanted to look back at what I did previously with the 50 000th R commit.

Here are the number of commits per day and month

commits_per_day.png commits_per_month.png

... the same thing, but focused on the period since I joined the project

commits_per_day__zoom.png commits_per_month__zoom.png

... and now split by contributor

commits_per_day_per_author__zoom.png commits_per_month_author__zoom.png

here are the month where each of us have been the most active

> rbind, 
    split( month_author_data, month_author_data$author ) , 
    function(x) x[ which.max( x[["commits"]] ), ] ) 
               date  author commits month year
dmbates 2010-08-01 dmbates      19    08 2010
edd     2010-06-01     edd     118    06 2010
romain  2010-06-01  romain     256    06 2010

and the most active day

> rbind, 
    split( day_author_data, day_author_data$author ) , 
    function(x) x[ which.max( x[["commits"]] ), ] ) 
              date  author commits month year
dmbates 2010-08-06 dmbates      13     8 2010
edd     2010-02-16     edd      20     2 2010
romain  2010-06-17  romain      30     6 2010

The code to reproduce the graphs is here

Rcpp at LondonR, oct 5th

I'll be presenting Rcpp at the next LondonR, which is currently scheduled for october 5th

Here is one picture I found on flickr, searching for london speed bus, ... there are many other

Saturday, July 31 2010

highlight 0.2-2

I've released highlight 0.2-2 to CRAN. This release adds the possibility to control the font size of the latex code generated by sweave (when using the driver that is provided by highlight)

For example, this C++ code (using Rcpp) will be highlighted in tiny size.

double square( double x){
  return x*x ;

SEXP foo( SEXP xx ){
  NumericVector x(xx) ;
  return sapply( x, square ) ;

This is something we had to do manually when preparing the slides for useR! 2010

- page 2 of 7 -