What good resources are there for R idioms, in the same line as there are for Java and Python?
-
2@dalloliogm Before ask check on stackoverflow: http://stackoverflow.com/questions/302459/what-is-a-programming-idiom – Marek Mar 10 '10 at 16:40
7 Answers
I would primarily recommend the R Inferno. In particular, study section 3 on vectorization, which is probably the key concept in R programming.
Beyond that, I would second Dirk's recommendation of John Chambers book.
Going a step farther: the R language is derived primarily from Scheme. One of the best ways to deeply understand R programming (as compared to a language like Java or C) is by learning about functional programming. For this, the best resource might be SICP (the "Structure and Interpretation of Computer Programs", available free online) which uses Scheme. You can find the relevant video lectures online as well: MIT 6.001 and Berkeley 61a.

- 98,550
- 35
- 224
- 217
-
2+1 for the R Inferno -- one of the most useful R tutorials I've read, I cant' believe I forgot to mention it :) It both teaches you R idioms and helps avoid some nasty traps. – Leo Alekseyev Mar 10 '10 at 19:12
There is Rosetta Code which presents many common programming tasks in different programming languages. Then there is a blog post by Stephen Turner that lists several ressources for programmers coming from other languages, for instance you can find slides from Drew Conway who compares Python with R.

- 17,826
- 11
- 69
- 103
Easy: 2200+ packages and counting on CRAN :)
Actually, jokes aside, the best description I have read was in Chambers (2008).

- 360,940
- 56
- 644
- 725
This is a very interesting question -- R is indeed full of idioms, and the situation is made even more difficult by the fact that there are many idioms for data analysis, in addition to the more general programming ones. Combined with R's expressiveness and its penchant for violating the principle of least surprise, this often makes the learning curve a bit steeper than one would like.
Personally, I picked up most of what I know by reading help, reading various tutorials and tip collections, and occasionally looking at source code of built-in functions. R FAQ has useful tidbits to start with. Revolution Computing has links to good resources, particularly for programmers. Also, I found Howard Seltman's collection of tips and links to be useful; I would bet that links on that page would cover most useful R idioms, but I am curious to see what else is out there.

- 12,893
- 5
- 44
- 44
This may or may not help you on your quest to figuring out R. But back when I was getting accustomed to R, I found that matlab to R dictionaries helped quite a bit (i.e. assuming you know how to use matlab). I can't seem to find the one I used, but found this one, which seems to illustrate things nicely.

- 791
- 8
- 19
Nowadays, I'd say the most definite resource on all details of the R language is Hadley Wickham's book. Reading this, you'll get a very thorough understanding of how R works. The book covers - among many other things - functional and object-oriented approaches to programming in R. Other chapters are devoted to the basic data structures and to performance issues in R. Note that this really is a published, high-quality book that is freely accessible online.

- 3,333
- 1
- 27
- 38
There is also Rchaeology: Idioms of R Programming by Paul E. Johnson, which is one of the vignettes for the rockchalk package.
He says 'it includes "deep insights" and programming advice that reflects the customs and mannerisms of the R leaders.'

- 41,615
- 18
- 132
- 227