R versus Python: A comparison
In this blogpost, I will share my first experience in using R. I am using Python for quite a while now and I am open minded for other technologies.
What is R?
R is an open source programming language and software environment for statistical computing and graphics that is supported by the R Foundation for Statistical Computing. I was surprised by the fact that it is partially written in Fortran, which is quite an old programming language (originally developed by IBM back in 1950). After reading more and more about R, it got to my attention that it is an alternative to traditional statistical packages such as SPSS, SAS, and Stata. That makes sense and in my opinion it pinpoints where R deviates from Python. R is mainly written having these graphical software packages in mind and Python is written from a developers’ point of view.
Great Stuff in R
Okay, I have to say that R is not bad. It is just another tool for solving problems. One of the great things of R is that it allows for list comprehensions (just like Python :-)). Most of the old programming language do not have support for it. List comprehensions are a nice way of writing mathematical expressions in a programming language. Definitely read more about it if you are interested in this Python list comprehensions article.
The greatest deviations when comparing it to Python, is its graphical user interface. In R, it is easy to create beautiful plots. In Python this is definitely also possible using packages like Matplotlib and/or using a Jupyter notebook. The deviation lies in the fact that the R user interface is natively written for the most popular operating systems. This has as advantage that it is easy to make interactive user interfaces in R. This is also possible in Python, but I think it is more mature in R.
Great Stuff not in R
R is just slow. Since Python is developed from a developers point-of-view, Python is optimized for speed. R is optimized for usage on the other hand. One other downside of R that it has a steep learning curve. It is hard to figure out how to use new packages, at least in my experience.
Python versus R, the winner depends on the kind of problem you are solving. Are you looking for speed? Then definitely go for Python. Do you need to create a statistical report? Then you can go for Python or R. In my opinion, most problems can be solved using a solution in Python and therefore I will use Python for most of my projects. If you disagree or if you have other thoughts on Python versus R, feel free to post a comment!