by temp453463343 · 13y ago · 0 comments
I've used both extensively (though not for statistics). R's syntax is a little more C-like and consistent than MATLAB's - however the biggest difference is documentation.
R's, like most open source documentation, is rather terse and often very unsatisfactory. This gets especially apparent once you get into 3rd party libraries and use things like Bioconductor. You’ll have no idea how things are designed to be used, and without a guru at hand to walk you through you’ll be in a world of pain. Googling for solutions is also very difficult (even using something like RSeek). There are some archaic boards that sometimes have what you need, but often you'll get stuck and not know what to do. What’s nice about MATLAB is that all the libraries are made by a competent team of engineers and they put in the money/resources to have good documentation. Even the more abstract rarely used libraries have decent documentation. In R, if you try using non standard libraries, you’re gunna get screwed.
The IDEs for R are also worse. RStudio is quite nice, but it's really bare-bones compared to MATLAB's IDE. The one really neat thing about it is that you can host it on a server and then remotely work on your work by just going to a URL.
Also I think there are legacy issues in R (though MATLAB has those too). So there are for instance matrices, dataframes and lists (which are list vectors, but not at all). Why there are these three formats that fundamentally do the same thing is beyond comprehension. (Maybe someone can give some insight) Functions will randomly return one type or another. I always find myself fighting to keep the types consistent and R keeps trying to mess with me. In MATLAB everything is a matrix, so that makes things a lot easier
Fundamentally the issue is that MATLAB has a much larger user-base than R, so you'll just have a much easier working with it.
If R's documentation and community was on the same level as MATLAB's then I would maybe consider recommending it. If you work in genetics and you need to use something like Bioconductor, then R is a must I guess. Most other libraries are Fundamentally it's just some syntax differences.
The expression "You get what you pay for" is really pertinent here.
Note: I personally still use R for plotting, because I’m personally more familiar with it. Otherwise I try not to touch it. Code organization for me always gets messy, but I guess that’s cus I’m used to writing in OO languages.
Many of your points are quite subjective. I could do the same thing with Matlab. For instance, I find it mind boggling that anyone could get anything done when you have to devote a separate file to every single functions. That seems incomprehensible to me. And yet, I realize that that's probably a mostly subjective thing that you get used to.
Personally, I find R's documentation excellent. When people complain about it, it's usually because they have mistaken it for a tutorial. It's not. It's documentation.
Without any data, I seriously doubt your claim that Matlab has a much larger user base. (There is considerably more activity in R on StackOverflow than in Matlab.)
Your complaint about matrices, lists and data frames is similar. Data frames exist for the same reason that there's a mean() function: a columnar data structure that holds differently data types in each column comes up so often and is considered so useful that it is built in.
pandas in Python was developed in a way that went out of its way to specifically _mimic_ these data structures because data frames are considered such a vital aspect of R.
And keep in mind that these criticisms are all coming from someone who _also_ recommended against switching...!
> When people complain about it, it's usually because they have mistaken it for a tutorial. It's not. It's documentation.
I don't really see the distinction. Documentation is supposed to explain to you how to use the code. You can call it whatever you want. If it's through a tutorial, then why not. R - and especially the non-standard packages you download through CRAN - have very terse documentation that barely explain how each function works on it's own, and much less how it works in the context of the rest of the package. You can't just tell the user what goes into the black box and what comes out and expect people to be able to use your software.
Sure they're are vignettes (I think that's the term), but they're really inadequate b/c they only scratch the surface of how the package is meant to be used.
Anyways, that's my 2 cents. I've spent soooo many hours fighting with R documentation trying to figure out how to get what I needed done. Sometimes months later I would find out there is a much better way to do something that simply was not explained anywhere. I'm OK at R now, but I went through a lot of pain to get to where I am now. I'd never wish it on anyone else.
My experience with MATLAB on the other hand has always been very pleasant. I spent like 3 hours going over the tutorial on how to use it (much better then R's "Introduction to R") and I hit the ground running. When I needed something a quick search through the help or online always turned up results.
I don't know whether it's an explicit or implicit design choice or just a happy accident, but I'm grateful that the R documentation doesn't try to hold anyone's hand and guide them through data analysis beyond their training.
R's documentation is terse and unorganized. Anyone who says different is obviously someone with more experience with the language (which is not how it should be). When people complain about the documentation it's because they're trying to learn, and if the documentation isn't together learning is painful. Learning R is painful.
Next- Learning is painful, and the documentation is horrible because: the actual built in functions or extensions are a nightmare of arguments that [sometimes do/sometimes don't work]. If you plot x and you don't want the key to show up then set auto.key=FALSE, if you plot class(x) = [something else] and don't want the key to show up set colorkey=FALSE, if you want to layer plots: load this library and format your data to a new S3/S4 (object) type, add them together, then plot them (without the library you can't add these objects)... In case you didn't catch that: I wanted to layer the plots so I had to load a function that made the objects I wanted to plot add, not load a library that would change the plotting driver.
The community around R is disenchanted. If you get into the right place on the web and ask about a feature that doesn't exist: more often than not I've seen the typical guru response of the type "It doesn't work that way - that's a feature, not a problem." Change is bad, and in my experience generally discouraged.
Finally (and perhaps this really doesn't need to be said) the more I've been working with it - the more I feel like the reason it is so popular is because you can load it up read your data set, google some of the more central functions, and poof - get that set of characteristic statistical answers everyone needs to have in their [presentation/HW assignment]. If you look at the answers in this thread you get 2 types A) it's impossible to use, B) it does standard statistical analysis really easily. In my narrow world view it appeals to people who don't work with software a lot - professionals who need some automated numbers on the side without hiring someone to do it right.
That all said, I still do use R. You can do some nifty statistical analysis pretty easily and push it to a vector plot, pop it open with your favorite editor and post edit it super pretty (in a few days).
(I'm not particularly an R fan. It's great for stats, numerical calculations and plotting, but it's not a good programming language.)