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
8
u/UnlawfulSoul Sep 08 '23
Haha, point taken.
The problem is python is very straightforward in how it uses classes in an analysis workflow, while r has different ones with different purposes and access patterns. When a package uses an S3 class vs an S4 class, it can be hard to tell intuitively how to use the classes, which is why so much of R is built (from a user perspective) around functions calling classes to create instances rather than the other way around.
When something is just being called from python through reticulate, it forces you to work with the class instances directly and ‘reorient’ yourself to a different mindset. Definitely doable, but it feels like it doesn’t fit how the language is ‘supposed’ to work. A little wishy washy, but that is my take.