4 ms·
This is fine and all, but I think they're completely ignoring the elephant in the room. R is a crazy, random, whimsical language that puts PHP to shame. I use
by pickdenis 7y ago
This is fine and all, but I think they're completely ignoring the elephant in the room. R is a crazy, random, whimsical language that puts PHP to shame.
I use Python instead of R unless I'm told to use R. I hate using R, even if there are better libraries written for it than the Python equivalents. I can't stand the terrible naming conventions (seriously, can't you at least be consistent with CORE FUNCTION names?) and ridiculous amount of data structures. There are vectors, lists, matrices, tables, data frames, S4 classes, environments, oh my... I've been programming in R for a couple of years now and it still takes me around 2-3 tries to figure out what's stored in a variable and how to access it. Do I need two ['s, a trailing comma inside the [], etc.
Debugging R basically seems to mean "use a hack to generate stack traces."
Maybe I'm just stupid, but I see _absolutely_ no reason to encourage use of R over Python. I love lisp and the ideas it espouses, but R seems to take the worst from that world.
- Frost1x 7y agoThe main reason to use R is the existing set of libraries and analyses pipelines some may already have in place. Redeveloping these in Python can be a hassle because there may not even be libraries that recreated certain functionality that one needs to recreate on-top of translating their pipeline. With that said, most common analyses needs are now handled in popular Python libraries. Sometimes though, the knowledge encapsulated in an R package is not trivial to understand and reimplement. The concepts methods use may involve math you're unfamiliar with (and use as black boxes), so then you have to look at the package code and try translating R->Python, then attempt to refactor to something sane (and hope you don't skip any underlying logic). That or learn the theory of what was implemented so you can now implement it in Python (which may not be feasible with tight deadlines).
- mistrial9 7y agopeople who are domain-focused and not programmers per-se seem to be less bothered by this.. at school, Very Productive People are split into both camps, python and R.. and Julia is gaining ground
- scottlocklin 7y agoYou haven't gone deep enough: the interactivity is vastly better, and the package ecosystem for statistics and data science is generally much more complete and actively developed. scikit learn is very good, but if you're not using that or doing dweeb learning, you're up the creek without a paddle. Python doesn't even give you matrices as first class citizens; while I used a lot of Python before I used R, it still feels like they bolted lapack onto an unrelated scripting language and built things with it. More or less because that's what it is. Personally I don't think the R language is anything special, good or bad: it's a typical sloppy interpreted language (though many of the difficulties described in the above 2010 document no longer exist). It's the package management system that makes it useful. It's not even a great package management system, especially when dumb kids use it like it's nodejs. But it's good enough to allow potentially crummy programmers (aka statisticians) to contribute meaningful and useful code to the ecosystem.
- j88439h84 7y agoWhy care if data frames are built into python or not? In R, I use tibbles anyway.
- roenxi 7y agoThe terrible naming is an annoyance, but the ridiculous number of data structures isn't as bad as R's tendency to jump between them in a semi-random manner. My example is if A is a matrix and b/c are variables then you don't know what the data type of A[b,c] is. I can tell you the types of A, b, c and that doesn't help; you need to know about the actual data stored in the variables to know if the return value is still a matrix or if R has thrown out the dimension information and jumped back to a vector (potentially transposing the result). You have to know about the drop=FALSE option and at that point the syntax of doing a complicated equation involving recursion and matrices falls apart. The syntax is an embarrassment for working with matricies. I'd rather use a lisp-style (-> A (mmul v) (subset 1 k 1 j)), which isn't ideal but at least it doesn't have random options being set in the middle of it. That single decision should be enough to disqualify R from being a well designed language for mathematical applications. The pigs breakfast that is the *apply() function family is a similar story. The distinction between vectors, matricies, lists-of-lists and data frames is archaic too, the conceptual model should be a single 2-d data structure and then support additional operations under certain conditions. At least that particular decision makes sense at the time R was designed.
- kestreloats 7y agoSo... I've been programming in R for over 20 years. I've been ready for an alternative for performance reasons for about half that time. Julia seems like a promising alternative, that I wish I could use all the time instead of R but it's just not there; I'd prefer Nim most of all but that's even less well-resourced in terms of libraries. Maybe a zero-cost abstracted offshoot of Rust will eventually come to have a role? Who knows. R, like Python, has far outgrown its initial scope. I don't think it was initially envisioned to be used the way it is today. But both have been kept in use as costumes for C/C++. One of the things I've noticed the most in the last 20 years, to your point, is that the language used to be a lot more straightforward and simpler, more predictable. Over the years a lot has been added in a sort of haphazard way, and as a result today you have this kind of Frankenstein language that isn't what it started with. As for data structures, though, I don't really see R as being that different from other languages. Many of them are the same as in other languages, but just have different names (and I do wish they used similar terminology). Others have been taken up in other languages as people have come to appreciate their utility. Being a wrapper for C/C++ can only go so far. Eventually you have to write in R (or Python) and the speed shows, if you have enough data to deal with.
- horsawlarway 7y agoThis. A million fucking times this. Full disclosure - I don't use R professionally. I use R when my significant other gets stuck on something in R while she's working with it professionally. I fucking hate this language. Full stop. I've worked with a LOT of languages - C, C++, JS, C#, Lisp, Basic, SmallTalk, Ruby, Bash, F#, GoLang, Custom DSLs, 1553 assembly, plus a lot more over the last 20 years I'm forgetting. R is my least favorite. The core language is riddled with with absolutely asinine idiosyncrasies. Operators that only work in certain specific cases. Operators that work one way with literals and another with variables. Operators that do what you expect until they don't. 15 fucking ways to do the SAME thing, all built into the language. R is like building on god damned quicksand. Crazy performance problems from random usage (ex: see the article...) that are not at all easily apparent (not to mention the several cases where the performance problems ARE apparent but nasty to work around). I have no doubt that R is a massively useful tool because of the libraries that have sprouted up for it. That said, I despise the base language. I'll take Matlab or Octave or Python over R any day when I need stats tools. I will ONLY ever use R when someone is paying me to use R (not to solve problems, TO USE R). It genuinely feels like a language where the users copy and paste code or pull in libraries and fudge with the syntax until it runs. I have genuinely lost a chunk of faith in science because of R. I have watched academics do exactly what I outlined above - Fudge with syntax until the library they're using doesn't blow up, take the result (with no FUCKING idea if the result is actually correct) and run with it.