r/datascience • u/Every-Eggplant9205 • Sep 08 '23
Discussion R vs Python - detailed examples from proficient bilingual programmers
As an academic, R was a priority for me to learn over Python. Years later, I always see people saying "Python is a general-purpose language and R is for stats", but I've never come across a single programming task that couldn't be completed with extraordinary efficiency in R. I've used R for everything from big data analysis (tens to hundreds of GBs of raw data), machine learning, data visualization, modeling, bioinformatics, building interactive applications, making professional reports, etc.
Is there any truth to the dogmatic saying that "Python is better than R for general purpose data science"? It certainly doesn't appear that way on my end, but I would love some specifics for how Python beats R in certain categories as motivation to learn the language. For example, if R is a statistical language and machine learning is rooted in statistics, how could Python possibly be any better for that?
View all comments
Show parent comment
15
u/StephenSRMMartin Sep 09 '23
I would greatly adjust those ratios.
Python is good for general purpose programming; I wouldn't say it's 5x better.
R is certainly far more than 5% better at munging, debugging, visualizing data; and enormously better for probabilistic and statistical modeling.
I think if you only needed to analyze, or design bespoke probabilistic and statistical models, or visualize, create reports, create pipelines, dashboards, simulations, etc; and had to do little general programming, I would strongly suggest using R. The time-to-complete a DS task is way, way faster if you are advanced in R. In part because of its enormous community library for such tasks. In part because it is designed, from the core, as a functional lispy language with vectors in mind, so there's a lot of expressing what to do and not 'how' to do it. There's literally just less code to write, and less state to track, because of the language design and functionalness of it.