Learning a new programming language is costly. Usually it takes a considerable amount of time to get acquainted with a new language. Especially the first phase can be painful and frustrating. The good thing is that with enough time and effort most of us will learn how to master a programming language eventually. However, note that, once we are comfortable with one language, we hardly want to change again. It turns out that the cost of abandoning on programming language and switch to another are even higher than at the beginning. Knowing this, we really want to make sure not to invest in the wrong language. There might be nothing worse than after finally mastering a programming language, recognizing that there is no use for this language anymore. While in a former post I highlighted reason why to use R, I concentrate on the Pros and Cons of R in this post.
Advantages of R
- Like most other programs, R programs explicitly document the steps of your analysis and make it easy to reproduce and/or update analysis, which means you can quickly try many ideas and/or correct issues.
- You can easily use it anywhere. It’s platform-independent, so you can use it on any operating system. And it’s free, so you can use it at any employer without having to persuade your boss to purchase a license.
- Not only is R free, but it’s also open-source. That means anyone can examine the source code to see exactly what it’s doing. This also means that you, or anyone, can fix bugs and/or add features, rather than waiting for the vendor to find/fix the bug and/or add the feature–at their discretion–in a future release.
- R allows you to declare names to objects, such as vectors, matrices, dataframes and lists. Furthermore, R also allows you to attribute names to columns and rows of these objects. A feature that turns out to be very handy when it comes to reference these objects.
- R permits you to integrate with other languages (C/C++, Java, Python) and enables you to interact with many data sources: ODBC-compliant databases (Excel, Access), other databases such as PostgreSQL and other statistical packages (SAS, Stata, SPSS, Minitab).
- Parallelism is straightforward in R. There exists several packages that permit you to take advantage of multiple cores, either on a single machine or across a network. Finally, one can also build R with BLAS.
- R has a large, active, and growing community of users. The mailing lists provide access to many users and package authors. Blogs and Q&A sites provide useful help and advice with all kind of problems. The large community ensures that for each problem you encounter there exists another user that encounter the same problem and is most likely able to help you.
Disadvantages of R
- Native R is slower than its main competitor – Julia, Python and Matlab. This critique is usually unjustified when you know how to optimize your code, e.g. you have various packages written in C. Nevertheless, packages in plain R and tend to be slower than other alternatives.
- R users profit a great deal from the inclusion of packages. Packages provide additional features and convenience functions that facilitate slice and dicing your data and conduct statistical analysis. However, the maintenance of packages depends on the goodwill and altruism of R users. In case a package maintainer decides to no longer sustain its package it will quickly be outdated and soon become deprecated. Furthermore, in comparison to other software, such as STATA and Matlab, package maintainer do not always ensure backward-compatibility. Thus, it might happen that your R scripts will not run with newer version of the same package.
- R is a extremely flexible programming language and does not impose strict rules. Hence, one needs a lot of discipline to maintain a proper coding standard. Lack of discipline can quickly lead to a hard-to-maintain R code. Especially, once the code grows bigger.
- Originally, R started as a language to serve statisticians that was designed to incorporate functional concepts along with a remarkable flexibility in syntax. However, as a result, every good, and bad, idea in computer programming has been incorporated in R.
I hope this list is a helpful overview of some advantages and disadvantages of using R. I am sure I have forgotten some things, so please add them in the comments.