How to configure Eclipse + StatET + Rcpp on Windows

When I found out that I could create an R package with C ++ using Rcpp, I was delighted with this and wanted to know the development environment for it. And thanks to the Fell Stat Blog , I could quickly create a great environment using Eclipse with StatET, my plugin for R, to use Rcpp and RInside (another package for embedding R in your C ++ application) on Windows.

Since the blog was, however, based on OS X, some things required trial and error (and almost abandoning them) in order to adapt to Windows - it took me 6 hours of my leisure time. For example, you need to install Rtools in order to be able to compile C / C ++ using the R CMD and Miktex instructions to convert your Rd files to a pdf file. In addition, build settings are different from OS X.

To save others from the possible trial and error that I experienced, I created this wiki on Eclipse + StatET + Rcpp on Windows. Feel free to comment or another answer. Otherwise, enjoy this wonderful open source development environment for the analytical software you can get.

UPDATE (end of 2016) . A few years ago, I changed the IDE for R from Eclipse to RStudio, and I recommend it for anyone using R and Rcpp.

+8
eclipse r eclipse-cdt rcpp statet
source share
2 answers

For this wiki, I will continue my discussion based on the latest version of R, R 2.15.1, and this is a list of the steps you need to follow.

  • If you have already installed R on your Windows system , make sure that there is no place in its path, such as "C: \ Program Files \ R \ R-2.15.1". If so, you cannot do anything, but reinstall your R system into a directory such as "C: \ R \ R-2.15.1". If you do not, Rcpp or RInside will not work on your system.

  • Install Rtools (in this case Rtools2.15.1) This installer includes basic tools for starting R CMD and related things and a gcc compiler. I set this to "C: \ Rtools"

  • (Optional) You can install MikTex to automatically create a pdf file from your Rd files when performing an R CMD check. Make sure that <Miktext installation directory>\miktex\bin is in your system path.

  • Include the following directories in your system path. It is important. Otherwise, most of them will not work here.

    C:\Rtools\bin; C:\Rtools\gcc-4.6.3\bin; C:\R\R-2.15.1\bin\i386;

  • If you do not already have Eclipse, install it from the CDT. If you already have one, make sure you have the CDT plugin installed.

  • Now it's time to install the Eclipse plugin for R, StatET As the website suggested, I used http://download.walware.de/eclipse-3.8 to install it. After that, they launched R-windows and installed Rj install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-1.1") After that you will finish the installation of StatET . At Eclipse, follow the Cheatsheet of StatET to familiarize yourself with the environment. In particular, create an R environment, R console configuration, external configuration to check R CMD, install, install so that you can run R and its CMD in Eclipse.

  • It's time to install Rcpp and RInside. As Fell Stat recommended, I used the following in the R console in Eclipse to do this. install.packages(c("Rcpp","RInside"),type="source") This will get the source of Rcpp and RInside from the Internet and compile them before installing them. If you get an error message here, then it's time to check that you followed everything that I described above. In my case, I got some when I did not set the system path to the right or when my path R included space.

  • Now it's time to explore the environment with a test project. To do this, I recommend that you read step 4, 5, 6, 7 from the Fell Stat magazine . One thing I recommend is that when creating a sample project, use

    Rcpp.package.skeleton("MyCppPackage", module=TRUE)

    This way you get the power of Rcpp with Rcpp modules.

  • As I said, in # 7, some settings are different from OS X in Windows. I will just show my settings here in the images. I did not specify directories for RInside here, but I hope you can easily figure it out from the Rcpp setup.

enter image description hereenter image description hereenter image description here

Hope this helps. Enjoy it.

+3
source share

You can use the batch installation of Eclipse and R called Architect from Openanalytics.

0
source share

All Articles