Python vs R

One thing a lot of beginning programmers stress about is deciding which programming language to learn. Today the big choice in working with data comes to Python or R


My Books teach you Python, along with libraries Pandas (manipulating data), BeautifulSoup (for scraping), seaborn (data visualization), and statsmodels and scikit learn (modeling and machine learning).

R is a statistical programming language and an alternative to Python. You can basically think of it as Pandas + a few other statistical libraries. It's a fine option. I started out in R, and am still moderately fluent. It's been around longer and has a solid MLB/football analytics following. Like Python, it's open source (e.g. free).

When it comes to data analysis, Python and R are a lot alike. Python probably has the edge in machine learning with scikit-learn, and Pandas is excellent (and getting even better all the time). R has the tidyverse, which a lot of people like.

For non-data applications Python is definitely better. People use Python to build their own APIs and websites, run their own servers, control their computers, robots, whatever.

That's probably why until about 5 years ago the R/Python split was about 50/50, but since then Python is the much more popular option (search for "R vs Python market share").

Programmers are more likely to move from R -> Python than the other way around.

Also interesting is this study of programmer migration patterns by programmer blogger apenwarr. He found that R users are much more likely to jump to learning Python next than the other way around.


As apenwarr explains, nodes in red below are "currently the most common 'terminal nodes' — where people stop because they can't find anything better".

Python 3 (which what we learn in LTCWFF) is a terminal node. R users (and Matlab, Fortran, etc) tend to migrate to it over time.

So if you're going to end up moving from R -> Python anyway (or, in my case SAS -> Stata -> R -> Python), it might make sense to save time and start directly with Python? If this sounds intriguing definitely check out the books: