Why R is better than Python? Maybe it is not and we should use both?

Hi,
I have a general question.
Why do you think R is better than Python?

There are multiple comparisons on the internet but I would like to know your opinion as you are already R users, not people considering using this software for analyses or visualizations.

Benchmarks https://h2oai.github.io/db-benchmark (not the best examples, because dtplyr or tidytables exist, or Cython and Numba for Python, but good enough in my book)

Better implementation of C++ (Rcpp) and other languages, but my knowledge on this could be outdated and wrong.

Python can't run R, but R can run Python.

Library mention necessities (Python's pd.xyz vs. R's xyz or library::xyz)

And for me, the syntax being similar to human languages (that I know) is pretty nice -- subject first is common. For example:

df |>
  function(args)

subject |>
  verb(object/'adverbs' or the hows)

It's a crude example, but it works for me nicely.

Dependencies

Last but definitely not least, debug messages

1 Like
  • dplyr is more elegant and powerful than pandas. I find pandas really clunky. Even just indexing you have to use the .ix method to index. And sometimes a pivot or merge will produce hierarchical indexes, which is really confusing.
  • the pipe operator in R is great and no equivalent in python
  • python is a messy mix of functional programming and object oriented programming while R is more purely functional. I find it difficult to remember in python if I need to sort(object) or object.sort()
  • python has way too many variable types. All those types leads to lots of debugging and head scratching. Just one example, map in R produces a list. map in python returns an "iterator object". I just want a list!
  • I like RStudio as an IDE more than PyCharm, VSCode, or Spyder
  • R notebooks much more customizable and presentable than Jupyter. I can't understand how it became acceptable to share messy Jupyter html outputs with code and output with non-programmer clients.
  • Python debuggers still use ipython which is so clunky and archaic. And because python has such a mess of data types and packages, I spend a lot of time in the debugger...
  • Much more straightforward in R to install software and packages. I hate when I have to mess around with pip and conda.
2 Likes

Both have their strengths and weaknesses, so the best approach is to choose the right tool for the job at hand at any given moment, even including tools other than R and Python.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.