I agree with @williaml.
There are three reasons why you'd want to develop packages with a C/CPP (or even Go):
- Speed
- To access functions from the vast armory of available libraries
- To have a richer suite of procedural/imperative coding tools to work from than are provided in base R
While we all chant faster is better, the truth is that for most day-to-day work, a ten-fold difference may amount to less than a second.
With packages like RCpp
, it's possible to access functions directly from R
without having to compile a C/Cpp program first.
R
mostly presents itself to the user as a functional language, not a procedural one. Identify a class of target object, compare it to a source object and then compose a function, often composite of many functions, to implement the f(x) = y. With thousands of packages, there is probably already one or more existing functions for any standard statistical problem. It's only when you cannot find a way to string together functions because a new algorithm is needed, for example, that it might be necessary to turn to writing it in C/Cpp
and, even then, there's Haskell
, a functional language to consider.