Keep calm and #include <Rcpp11>

June 19, 2014

(This article was first published on R Enthusiast and R/C++ hero, and kindly contributed to R-bloggers)

Following up on this post, I have just commited some code that makes the using namespace Rcpp11 ; automatic, I was just tired of typing it. So now, you can just do :

#include <Rcpp11>

If however, for some weird reason (some people love littering their code with Rcpp::) you don’t want the using namespace Rcpp11; to be automatically added, you can either switch to :

#include <Rcpp.h>

or define the RCPP11_DISABLE_AUTOMATIC_USING_NAMESPACE macro before you include <Rcpp11>:

#include <Rcpp11>

I know that’s a lot of typing, but the idea is to make the most useful pattern (you almost always want to have using namespace Rcpp11 ;) easier than the less useful.

Unsurprisingly, the <Rcpp11> header looks like this:

#ifndef RCPP11_includes
#define RCPP11_includes

#include <Rcpp.h>

using namespace Rcpp11 ;  


To leave a comment for the author, please follow the link and comment on their blog: R Enthusiast and R/C++ hero. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)