Comments 4
The novice can easily learn R programming language within minutes by doing simple data analysis.It depends much from previous learner experience.
R is more easy for statistic specialists without much previous programming experience, but Python is much more easy to understand for learners with basic programming experience.
I learned Python quite a lot and tried learn R. For me R seems very non-intuitive and hard to learn — it looks not like strict logical programming language, but more just like set of statistical tools where same things can be done in lot of different ways what confuse learner.
And R have no use outside data-science, while Python can be used in lot of different fields, so it's much more useful, is rising in his popularity from year to year and I am pretty sure it will continue replace R in future.
Stop directly comparing Python
and R
, these are two completely different tools. Python
is a simplified language designed to basically solve everything at the cost of performance/maintainability. R
is designed for data science and visualization. Period.
1)
When you compare data structures, it would be nice to see both Python
and R
implementations, as well as performance comparison. In order to get a tree-like structure in R
, you can probably use environments, or write a faster implementation in C/C++ (with the help of e.g. RCpp
), or look for a CRAN/GitHub package with said functionality.
2)
Comparing Python 2.7/3.x
debacle to R
and tidyverse
relationship is simply inappropriate. While Python
introduced breaking changes and some packages are not being ported to 3.x
, R
versions have been consistent.
tidyverse
is an addon to R
, a set of packages that can be used at any point in the code. tidyverse
is closer to numpy
/matplotlib
libs from Python
. There is always an alternative, but tidyverse
happens to be more widely used.
3)
Python programming language has one OOP paradigm while in R, you can print a function to the terminal many times.
I fail to understand what does it even mean. Anyway, you show no examples of Python
metaprogramming/OOP features, at the same time presenting a very poor example of R
metaprogramming in a form of code generation. It would be nice to have an explanation of R
OOP mechanics, S3
as the very basic level, S4
, reference classes, proto
(which powers ggplot2
OOP) and R6
. This could be compared to Python
more traditional OOP system with decorators (which do provide some level of metaprogramming).
9)
R
learning curve can be much steeper than that of Python
. Python
was designed to be simple and understandable and its syntax is very concise. R
, on the contrary, differs from typical programming languages. It is also affected by its predecessor, the S
language. In R
, virtually everything is an expression, and this feature, together with the non-standard evaluation, are the greatest tools that R
has to offer. R
also has formulas, a quite strange type that is used in e.g. machine learning/fitting procedures (like lm()
). Formulae,NSE
and environments are at the core of grammar and syntaxis of tools like ggplot2
, dplyr
, purrr
, data.table
and so on. I doubt that learning to understand NSE
and environments is easier than mastering advanced Python
OOP.
10)
Elegance is indeed subjective. I find R
more elegant because it naturally allows for functional-style piping (thanks to magrittr
and friends). Pipes, NSE
used within dplyr
/data.table
, lambdas that are constructed from one-sided functions in purrr
(~ .x + 5
), pronouns like .
— all these features make R
more elegant, in my opinion.
Python
, however, has a very typical imperative/OOP syntax. Its only advantage is the absence of braces/other scope delimiting symbols and usage of short keywords (like def
, pass
, with
). The indentation may sometimes make the code less elegant.
Python or R: Which Is A Better Choice For Data Science?