Re:Rsuite – R development and data science platform
by lbeltrame on Sunday December 15, 2019 @04:49AM
(#21795369)
IMO the worst is accessing non-existent items in lists or when using the $ or [[ notation in data.frames: the fact that you get back NULL instead of an error breaks code in unexpected ways, and given that R's debug facilities are basically useless, makes it hard to debug complex code.
Re:Rsuite – R development and data science platform
by Zelazny7 on Saturday December 14, 2019 @06:51PM
(#21793268)
when indexing you can always pass `drop=FALSE` to prevent returning a vector. It will always return a matrix or data.frame.
Re:Rsuite – R development and data science platform
by zmmmmm on Sunday December 15, 2019 @12:05AM
(#21794567)
Still - that's an excellent example of something that's broken by default and outright dangerous for production use and at the same time very convenient when using interactively. There are probably half a dozen similar other features.
The vast majority of packages are written by somebody taking their interactive session and tidying it up with some functions and tests and then publishing it. But going through and weeding out all these "broken by default for edge case" aspects is a nightmare.
None of this makes R a bad language, in my opinion. R is far from the only language with surprising edge cases like this. People say that R is designed for statistical analysis more than general programming, but I don't think that's exactly true either. Certainly it excels in writing code for statistical analysis, but I've used R a lot more than that, and I plan to continue. It's a perfectly fine general-use scripting language.
I think the real reason R gets such a bad reputation is that a lot of people writing and publishing R code aren't programmers by trade. And you know what? That's fine. Because I'd much rather work in a community that values and celebrates the publishing of code than one that shames people for releasing their code because it's "not good enough".
[1]: https://www.burns-stat.com/pages/Tutor/R_inferno.pdf