News for hackers. Stuff that matters.
Re:The R learning curve by abraxasz on Thursday February 07, 2013 @09:58PM (#5186043)
I've had to learn R during my master (in statistics), and found the process very unpleasant.

There are different ways in which a language can be difficult to learn. Haskell has a steep learning curve because it has a lot of unusual concepts (for those who come from an imperative background) and requires a shift in the way we think about code. J is also difficult to learn because the syntax is crazy, and again, the language is very different from what we're used to.

I found R difficult to learn because it is seems inconsistent to me. Now one reason might be that I picked up bits of R here and there without taking the time to learn the syntax from a book (unlike what I did for other languages), but it took me quite some time to be able to make sense of the different structures (vector, list, matrix, dataframe), their differences, and in particular how functions operate differently on these structures. I also have a deep hatred for the system of attributes (why would anyone want to give attributes to a vector...), and find the indexing system (especially for lists) to be nonsensical. In fact, I think that lists themselves are terrible to work with.

The general impression that I've had learning R is the language is not coherent and systematic in its design in the way other languages are (I know python, c, common lisp, ...), and I find myself spending a lot of time in the interpreter simply trying out things because I'm not sure that it will return what I want, in the format that I want (which never happens to me in any other language).

Now don't get me wrong, I use R daily and it's a useful tool. It has lots of great libraries, including the fantastic ggplot2, and the remarkable Rcpp (best C++ interface I've ever seen.. ok I haven't seen any other, but this one is really great). But learning it was no fun, and if the statistics community decided to move to a cleaner language, I'd definitely be running ahead..

Re:The R learning curve by EzGraphs on Thursday February 07, 2013 @10:02PM (#5186057)
In R, I often can write a dozen line program that will do something incredible, but it might take an hour to hammer out those lines and cannot reconstruct them from memory because of inconsistencies in syntax. It sort of feels like a statistics DSL built on Lisp.
Re:The R learning curve by pseut on Thursday February 07, 2013 @10:26PM (#5186120)
R is exactly like a statistics DSL built on Lisp. The first sentences of a talk by Ihaka [1] are:

> R began as an experiment in trying to use the methods of Lisp implementors to build a small testbed which could be used to trial some ideas on how a statistical environment might be built. Early on, the decision was made to use an S-like syntax. Once that decision was made, the move toward being more and more like S has been irresistible.

Since I find it basically impossible to remember how 'eval', 'quote', 'substitute', etc. work in R, I suspect that the Lispers are onto something when they say that the lack of syntax in Lisp is an important feature.

[1] http://www.stat.auckland.ac.nz/%7Eihaka/downloads/Interface9...

Re:The R learning curve by RockyMcNuts on Sunday February 10, 2013 @04:06PM (#5197911)
R makes the hard things easy and the easy things hard.
Re:The R learning curve by groovy2shoes on Friday February 08, 2013 @01:22AM (#5186574)
> I found R difficult to learn because it is seems inconsistent to me. Now one reason might be that I picked up bits of R here and there without taking the time to learn the syntax from a book (unlike what I did for other languages), but it took me quite some time to be able to make sense of the different structures (vector, list, matrix, dataframe), their differences, and in particular how functions operate differently on these structures.

If it makes you feel any better, I've read several R books and they normally present it in an inconsistent manner as well. I've written programs in some 30 languages over the last 13 years, and I've yet to encounter one that's as difficult to pick up as R. Materials that purport to teach R are, in my experience, almost always presented as a set of recipes for very specific statistical methods. That approach stands in stark contrast from traditional programming introductions that attempt to teach general concepts rather than specific how-tos.

I agree, though, that despite the learning curve, R is rather useful.

Re:The R learning curve by hadley on Friday February 08, 2013 @08:01AM (#5187609)
I'd appreciate any comments on https://github.com/hadley/devtools/wiki - it's my attempt to teach R like a programming language, focussing on cross-cutting concerns and general concepts. It's still a work i progress, so your feedback can help make it better.
Re:The R learning curve by abraxasz on Friday February 08, 2013 @10:24AM (#5188254)
I read it cover to cover (so to speak) about two weeks ago, and although still a work in progress, it is indeed the best written guide to R that I've read to date. It appealed to me because it insisted on the functional programming side of R, and explained some of the intricacies and advanced concepts in R. It's pretty dense though and will certainly require a number of re-reads before I internalize all of the material.

One thing I would find very useful is a case study on how to design more complex packages. In particular, I would love to have an executive summary of the inner-working of ggplot2 and/or ddply. In particular, how can I manage to pass formulas as arguments to my functions, how can I achieve the pseudo DSL effect of ggplot2, etc... I know, I could read the source on github, but ggplot2 is pretty big, so a summary would be helpful.

Re:The R learning curve by hadley on Friday February 08, 2013 @11:35AM (#5188655)
I think as I flush out the functional programming and computing on the language sections, those techniques underlying ggplot2 and plyr should become more obvious. I like the idea of case studies on more complex packages, but I don't know if I can bring myself to try and describe how they work :/ Part of the problem is that I didn't understand the techniques terribly well myself when I wrote ggplot2 and plyr, so they don't have particularly clean implementations.
Re:The R learning curve by disgruntledphd2 on Friday February 08, 2013 @01:18PM (#5189268)
I have to second the usefulness of devtools/wiki. Its wonderfully clear and concise, though it does take some getting one's head around. And I write R every day and have read all of Venables and Ripley (more than once) and R still trips me up quite a lot. I tend to understand the error messages now, which is certainly progress.
Re:The R learning curve by Hansi on Friday February 08, 2013 @03:16AM (#5186853)
I've been working with R 90% of my time over the last two years and I agree it's a freakishly inconsistent language.

Me and the team I work with are still finding out weird completely illogical errors that effect the language but I think I've somehow started loving it despite all it's flaws and I did actually semi-enjoy the process of figuring out all those little wtf issues.

For those starting out with it reading this book + r inferno helps a lot with understanding the underlying weirdness and inconstancies of the language: http://www.amazon.co.uk/The-Art-Programming-Statistical-Soft...