Hacker News new | ask | show | jobs
by Lyngbakr 1319 days ago
I've also seen my fair share of garbage R code and I think Gordon Shotwell's comment that "There really are no production languages – only production engineers" speaks to this.[0] A big problem in the scientific community is that scientists aren't trained to write code like production engineers. I don't see it necessarily as being an issue that is endemic to R, though.

Packrat[1] — an RStudio package — can be used to easily avoid the library versioning issues you describe. The problem isn't that the tooling isn't there or that it isn't easy to use. It's that some folks simply don't use it and are perhaps oblivious as to /why/ they should even use it, anyway.

[0] https://shotwell.ca/posts/2019-12-30-why-i-use-r/ [1] https://rstudio.github.io/packrat/

3 comments

Maybe, but I wonder if it is especially easy to produce horrific code in R. For example, I remember trying to refactor an R codebase that made ample use `load`, leading to all these mysterious variables appearing from nowhere.
packrat is a little old. You want renv, which is the iteration of the same idea and I've found works very simply and nicely.
Also R really didn't play well with conda for a while. It seems to be ironed out in recent years, but I remember the issues of previous years where trying to set up a reproducible R environment in conda was an unreliable endeavour.