Almost exactly a year ago, I wrote about my frustration calling C++ from R. Maybe this will become an annual event because I’m back at it.
This time my experience was more pleasant. I was able to install Rcpp on an Ubuntu virtual machine and run example 2.2 from the Rcpp FAQ once I upgraded R to the latest version. I wrote up some notes on the process of installing the latest version of R and Rcpp on Ubuntu.
I have not yet been able to run Rcpp on Windows.
Update: Thanks to Dirk Eddelbuettel for pointing out in the comments that you can install Rcpp from the shell rather than from inside R by running sudo apt-get install r-cran-rcpp
. With this approach, I was able to install Rcpp without having to upgrade R first.
Could you please add that ‘sudo apt-get install r-cran-rcpp’ is also available in Debian and Ubuntu?
Also, I really agree with the ‘no to personal library’ as Unix/Linux are multi-user. The directory /usr/local/lib/R/site-library is of group staff — if you add yourself to that group you don’t need the sudo.
It is complementary in the sense that the ones in the distro are older (frozen when Ubuntu freezes; or when Debian goes ‘stable’) but there are the various ‘cran2deb’ initiatives — google for Michael’s c2b4u building on our earlier cran2deb which has now also be reconstituted at debian-r.debian.net; see eg http://stackoverflow.com/questions/9644699/difference-between-installing-a-package-from-source-and-from-compiled-binary
Lastly, Rcpp on Windows works just fine too. It helps to have R and its libraries in a path without spaces, which is recommended but for some obscure reason never suggested/enforced by the R installer on Windows.
Thanks, Dirk. I didn’t know about installing R packages from
apt-get
.Dirk: I’ve updated my blog post and the PDF notes to include installing Rcpp via
apt-get
.On Windows, I always install Unix-like software under
C:bin
to avoid problems with software that has trouble with spaces in paths.I was able to install Rcpp on Windows, but not able to get the example code to run. I ran the code from the same source file successfully on Linux, so I don’t believe there is an error in the code itself. R tells me
I think P.J. Brown categorized that sort of error message as one of his “deadly sins” in his compiler book.
That was in the 1970’s, I suppose we’ll still be seeing the same type of thing thirty years from now.
Hello John, just to add some info in case you are willing to come back to Windows the next year :-)
In Windows, I had an error message similar to the one you show in comment #6, and, yes, I did install R in a folder with a name without spaces.
I see in your message that the standard error is redirected to the file fileda0e163d0.cpp.err.txt, I had an error message referencing a file with a similar name but I did not find the file on my disk.