Tutorial
In the process of putting together the ptinpoly package, I learned a lot about making R packages that call underlying C++ code, as well as about how to use R-Forge. Here's a hands-on tutorial that brings together the things I have learned.
- The Tutorial (PDF File, v. 1.14, January 11, 2011). This tutorial covers how to make a C++-based R package in Chapters 2-5, and how to use R-Forge in Chapter 6.
- ZIP file containing example C++ and R code for the tutorial: Code.zip
If you'd like to download the C++ and R code as individual files rather than a ZIP file, here are links:
C++ code: RMat.cc, RMat.h, testRMat.cc, RInterface.cc
R code: MatrixMult.r, TestRMatDLL.r (the latter file isn't actually referenced by the tutorial but may be useful for Chapter 4.)
-- Jose M. Maisog
Links to software
Required
- R (obviously, R itself is required; comes with the RCMD utility)
- RTools (provides perl, for running RCMD; and gcc, for compiling C++ code)
- PuTTY (to establish a secure channel with R-Forge)
- TortoiseSVN (for using R-Forge, once the secure channel is established)
Optional
- MiKTeX (might not be absolutely required for creating an R package, but required for creating PDF help files)
- Microsoft HTML Help Workshop (install if you want .chm help files in your R package)
- NotePad++ (may be a nice editor for small-scale C++ projects)
- Dev-C++ (suggested for larger-scale C++ projects)
Links to relevant web sites
R-Forge
CRAN
Some References
Alan Lenarcic's Tutorial (based on underlying C++ code)
Rob Hyndman's Tutorial (based on underlying C or FORTRAN code)
John Chambers' book: Software for Data Analysis: Programming with R
Friedrich Leisch's Tutorial (based on R scripts only, no underlying compiled language)
Joseph Schafer's Tutorial (based on underlying FORTRAN 95 code)
Rcpp (interesting R package to help create new R packages based on C++; tutorial)
Comments (0)
You don't have permission to comment on this page.