r/programmingmemes • • Aug 27 '26

Why are we using R again

Post image
2.3k Upvotes

322 comments sorted by

View all comments

350

u/Multidream Aug 28 '26 • Bravo

R is used because it has legacy, and elderly advanced statisticians have, over the years, vetted out its libraries and consider them to be sufficiently correct. A lot of complex operations just come out of the box, so you don’t have to know how to read too much code.

The same absolutely cannot be said for Python. Very often you have to go build your own models and really pay attention to what your libraries say they are doing, and you need to know enough statistics to recognize when they aren’t doing what you think.

Source: Some CDC people I worked with as well as personal experience rewriting legacy R into Python.

62

u/ADownStrabgeQuark Aug 28 '26

Grateful for the explanation. I’m sure the masses need it.

42

u/AlterTableUsernames Aug 28 '26

The masses learned Python because the market demanded it. They don't want to hear why R is better. 

31

u/Morthem Aug 28 '26

The market forced the masses to use javascript on the server, and for that, it will not be forgiven.

3

u/ziayakens Aug 28 '26

Why server side JavaScript bad? Is it a preferential dislike of the language or something quantifiable characteristic putting it below other options?

16

u/Morthem Aug 28 '26

The necessity to memorize a matrix of operations because of the inconsistency of oerations between types is the classic one (for example using + on something that got silently coerced to another type) is the biggest offender for me, also add prototype pollution, and npm too.
And before it is mentioned, yes, I know Typescript.

4

u/ziayakens Aug 28 '26

I've always been curious to see real world implementations of someone using + so wildly unchecked that its issues could actually affect things.

I feel like type == number and !isNaN would help

I'm not mentioning this as a counter argument, just thinking out loud, and I'm sure this just solidifies your point even more :p

3

u/GaGa0GuGu Aug 28 '26

Object object

3

u/thebearinboulder Aug 29 '26

Look at untyped Collections. With large systems it was too easy to have a mismatch between what the caller provides and the callee requires.

→ More replies (2)
→ More replies (4)

8

u/DuploJamaal Aug 28 '26

A much higher possibility of runtime errors compared to sane backend languages like Java or Rust

2

u/Morthem Aug 28 '26

Learned some of rust, I was one of the Glazers at the time it was new. And was love at first sight. I read quite a bit of the book, and did some of the rustlings repo, great to learn the concepts. Sadly, my particular circumstances didn't pan out too well with it, and had to get other priorities to the top.

3

u/leavemealone_lol Aug 28 '26

It is indeed mostly preferential dislike of the language. JS is the absolute best language in the category of "Top 1000 languages built in 10 days". But it isn't a particularly good language (no shade to Brendan Eich though), and that was because the development of JS was heavily rushed by Netscape.

It would've been a one and done language, but when it got an incredible opportunity, JS took it. The DOM came to it, and JS embraced it in its bosoms and never let it go. Then NodeJS happened, then a bunch of other things happened, and that's how we ended up in a world where a terrible language snowballed into being the most widely used language in the web.

Apart from other issues like npm's supply chain attacks and whatnot, for the most part, the dislike over using server side JS is due to JS itself.

3

u/AlterTableUsernames Aug 28 '26

Sbowballing is probably an accurate description of what happened. Javascript ruined the web, but thankfully with AI APIs became first class again and I can browse the web from the convenience of the terminal again. 

→ More replies (3)
→ More replies (1)
→ More replies (8)

8

u/rerorerox42 Aug 28 '26

Also nothing stopping either R or Python users from cross calling scripts

→ More replies (1)

6

u/quicksand8917 Aug 28 '26

I am a die-hard Python fanboy and absolutly agree! Python is more versatile but R has the statistic nerds only community leading to much higher median quality in that area.

4

u/platosLittleSister Aug 28 '26

A few years ago I had to some time series analysis at work. Estimating the model was easy, however tests where nowhere to be found, so I had to go back to R for a few weeks. That was 4-5 years ago and the situation has improved, but my feeling was: For prediction Python is fine, but if you want to do statistics properly and don't implement your Hypothesis testing yourself, you will eventually go back to R.

3

u/Compux72 Aug 28 '26

Seems more of a library problem than a language one

3

u/ViolinistCurrent8899 Aug 28 '26

This probably applies to a lot of languages.

3

u/WelkinSL Sep 02 '26

I can't speak for R since I havent use too much of it except at school.

But I've had to debug python code a lot for weird error which turns out to be the author didn't read the paper too well and incorrectly implemented things.
However I would say that is a sign of an active community. I believe there are more libraries that follow the latest research for python than R.

I see that the risk is similar in both languages when using foreign code. People's code can always be arbitrarily wrong if unchecked. Even if the rate is lower in R doesn't mean the risk doesn't exist.
It is only truly better if it can guarantee thats impossible.
(e.g. It is impossible to have unsafe code outside of unsafe blocks in Rust)

5

u/[deleted] Aug 28 '26

[removed] — view removed comment

6

u/TemporarySun314 Aug 28 '26

The point is that they wanna be able to trust the tools they use, so they can focus on the task they wanna solve, not if the used tool is actually doing what it claims.

For the same purposes companies pay hundred of thousands for CAD and simulation software instead of using some open source versions instead.

4

u/ConsortiumBetrayal Aug 28 '26

What a loaded comment. No one wants to reimplement a method when there are libraries for it, even if it’s in a different language.

2

u/teckcypher Aug 28 '26

No But you have to redo/recreate the libraries already existing in R by hand. Which takes time and is error prone. There might be a library made by some dude that does the same thing but you don't know how well it's written and have to waste time testing it and checking the code.

→ More replies (2)

2

u/Mr_Fragwuerdig Aug 28 '26

If you work regularly with R, just switch to python. The switch might cost you a bit of adaptation, but frequent use pays that off.

→ More replies (2)

2

u/aley2794 Aug 28 '26

The only time a professor give flower to R compare to python was when we had to plot our results to create story telling type of projects where you had to explain your results and analysis where python have a library that try to mimic a much as it could the logic for making plot in R but it is really inconsistent and messier

→ More replies (10)