Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
R programming for those coming from other languages (johndcook.com)
109 points by llambda on Jan 3, 2012 | hide | past | favorite | 12 comments


Heavy R user here. When I was starting out, this: http://cran.r-project.org/doc/contrib/Short-refcard.pdf was a savior and goes well with this piece.

As others have mentioned, getting into the useful data structures and libraries is the next step here, because those are what makes R great. The book "R in a Nutshell" is a nice desktop reference, and the CRAN Task Views for your domain are a pretty helpful jumping off point: http://cran.r-project.org/web/views/

The R mailing list and Stack Overflow communities are also a tremendous resources.


While I agree on the R mailing list and StackOverflow (subscribe for r on the RSS feed) i would respectfully suggest that you ignore R in a Nutshell. While it does have some interesting worked examples and some good explanation, the book is essentially a commented version of the R introductory manuals.

The refcard is wonderful though. Personally, I found R bloggers really useful, just reading through all the articles is a nice way to learn the packages and tricks of the language (some of the code on the R help mailing list is also extremely useful here).

In terms of short, concise, wonderful books Data Manipulation with R is a favourite. Its only 150 pages, but it describes how to move your data from one form to another in the best and easiest ways. The SQL stuff and the regular expressions might already be known to the people here, but some of the material on dates, times and general reshaping of data was extremely useful (to me at least). R is not strong in this area, IMO and its nice to see some guidance in this area, as R packages often have funky data shape requirements.


Fair enough - I've had some good experience pointing new R users to R in a Nutshell - but maybe Data Manipulation with R is better. Haven't used it and will take a look.

One invaluable resource I forgot to point out was: http://www.statmethods.net/ Very concise, directed pages that help you understand common/acceptable ways to do specific things.

For plotting, I usually skip the base R plots and go with ggplot2.


While it does have some interesting worked examples

This sounds good!

and some good explanation,

Also sounds good.

the book is essentially a commented version of the R introductory manuals.

The question that comes to mind: exactly how good are the comments?


They are reasonably good. Its definitely not a bad book, but its not one I would recommend as almost all of the information it gives is in the manuals. If you have programming experience, you're better off reading the manuals. I didn't when I started learning R, but even then I felt somewhat cheated by the reams and reams of man pages included with a text which I had paid for.


While this looks like a good basic article for programmers learning R I recommend moving onto The R Inferno: http://www.burns-stat.com/pages/Tutor/R_inferno.pdf The R Inferno touches on do's and don't within R programming. The burns-stat.com website is also a good reference for R tutorials as well.


Thanks for that link. That's chock full of good tips for working in R, and definitely addressed at least a couple things I spent a while debugging.


> It is sometimes possible to use = for assignment, though I don't understand when this is and is not allowed.

Little bit of interesting history on this was just a google away: http://blog.revolutionanalytics.com/2008/12/use-equals-or-ar...


I'm not sure that post is 100% correct. Reading it gave me a bad feeling that it missed something I'd read in the past. See here for example ...

http://stackoverflow.com/questions/1741820/assignment-operat...

The = operator is only a "top level" construct, while <- can be used anywhere. Now exactly what those limitations are may be a bit subtle (the OP's point), so I also just use <-.


R is so ugly. Octave / Matlab is supposed to have inconsistent syntax and behavior but at least wrt matrices it seems much cleaner. So, is there a language (like R or Matlab) that's beautiful and well thought out? Mathematica?


There's a new book that seems to be about best practices for writing software in R. It's called 'The Art of R Programming'. I got a review copy but I haven't read it much yet, but the premise is that the book actually focuses on R programming techniques as opposed to introducing statistics using R.


Useless article: he didn't even bother to explain data frames, one of the most used data structures in R.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: