Êtes-vous un étudiant de l'EPFL à la recherche d'un projet de semestre?
Travaillez avec nous sur des projets en science des données et en visualisation, et déployez votre projet sous forme d'application sur Graph Search.
This manual will be useful for people looking to extend R with the C compiled code. The motivation for using the C interface with R may be bidirectional. For statisticians programming mainly in R, an interface to C provides fast execution of code and better memory management. The C interface also provides the user to access the existing C libraries. Similarly, people programming in C with the help of the R interface to get an access to huge set of mathematical functions implemented in R. It saves the labour of implementing such functions from scratch in C which may be quite cumbersome. In this note, the document illustrates one way to link the C compiled code with R using R function called .C. The use of the .C interface is quite simple and has been explained with the help of examples. The code for examples have been developed in C and various examples shows its execution from R. It is assumed that you have some prior knowledge of C programming and acquaintance with the basics of R. The code discussed in this document should work with any unix installation of R. There is also a PDF manual called Writing R Extensions vailable from the CRAN website. The manual describes other interfaces like .Call and .External which are more complicated to use but certainly more powerful. The following document explains briefly the .C interface.
Denis Gillet, Juan Carlos Farah, Adrian Christian Holzer, Abdessalam Ouaazki
Michaël Unser, Alexis Marie Frederic Goujon, Joaquim Gonçalves Garcia Barreto Campos