Switching From C++ to R – Limitations/applications


I’ve only recently begun exploring and learning R (especially since Dirk recommended RStudio and a lot of people in here speak highly of R). I’m rather C(++) oriented, so it got me thinking – what are the limitations of R, in particular in terms of performance?

I’m trying to weigh the C++/Python/R alternatives for research and I’m considering if getting to know Rwell enough is worth the time investment.

Available packages look quite promising, but there are some issues in my mind that keep me at bay for the time being:

  • How efficient is R when it comes to importing big datasets? And first of all, what’s big in terms of R development? I used to process a couple hundred CSV files in C++ (around 0.5M values I suppose) and I remember it being merely acceptable. What can I expect from R here? Judging by Jeff’s spectacular results I assume with a proper long-term solution (not CSV) I should be even able to switch to tick processing without hindrances. But what about ad-hoc data mangling? Is the difference in performance (compared to more low level implementations) that visible? Or is it just an urban legend?
  • What are the options for GUI development? Let’s say I would like to go further than research oriented analysis, like developing full blown UIs for investment analytics/trading etc. From what I found mentioned here and on StackOverflow, with proper bindings I am free to use Python‘s frameworks here and even further chain into Qt if such a need arises. But deploying such a beast must be a real nuisance. How do you cope with it?

In general I see R‘s flexibility allows me to mix and match it with a plethora of other languages (either way round – using low level additions in R or embed/invoke R in projects written in another language). That seems nice, but does it make sense (I mean like thinking about it from start/concept phase, not extending preexisting solutions)? Or is it better to stick with one-and-only language (insert whatever you like/have experience with)?

So to sum up: In what quant finance applications is R a (really) bad choice (or at least can be)?

Karol Piczak


Don’t have to switch — it’s not either / or after all.

Use either where it has an advantage: R for explorations, modeling, … and C++ for industrial-strength and high-performance implementations (at a possible cost in terms of time to code).

And (with the obvious Rcpp plug coming) you can even combine both of them.

Dirk Eddelbuettel

Stack Exchange