Its a nice post but its still my contention that the best method by which to learn any language is the "There ain't nothin' to it but to do it" method. That is, to learn by experimenting with the language and by trial and error.
I picked up R 2 weeks ago at work. I didn't know anything about it and I sucked at using it. I am proud to say that after 2 weeks of hard work, cursing at the computer monitor and beating my head against the cubicle wall, I am dramatically better than I was-- comparable to the experienced R programmers who work here.
I almost forgot. This link is an R resource that was very helpful to me. I hope it will be helpful to anyone else who may need it: http://www.rseek.org/
> its still my contention that the best method by which to learn any language is the "There ain't nothin' to it but to do it" method.
Absolutely true, but you still need something to read to introduce you to the basic syntax and the general concepts of the language. Having a bridge between a known language and a new language can significantly speed this phase up, and get you quickly to the point where you're able to start experimenting.
Right. I briefly used R for research while I was in school. It was definitely a valuable tool for generating sets of random numbers, doing some statistical operations on them (PCA and SVD if you must know), and outputting them to a file that I could then pipe to my C program. It was a good example of doing one thing and doing it [pretty] well.
That said, I only learned enough of R to get it to do what I wanted. The help in the interactive mode was all I really had to go off of then, and that was very helpful with plenty of examples. Being a relatively uncommon, single-letter language name, google wasn't giving me anything useful at the time. I see that is now much improved now, but this tutorial - mapping it to other languages and explaining syntax gotchas - would have saved me several hours of ramp-up for the simple tasks I wanted to accomplish.
> its still my contention that the best method by which to learn any language is the "There ain't nothin' to it but to do it" method.
This is really good method, but doing it alone may not teach you the correct paradigms of the language. You can write FORTRAN in any language, but you probably shouldn't.
If I were about to learn Python by just converting some PHP fragments, I would surely miss those characteristics that seperate Python from PHP. However, by reading other people's code or reading some documents on idiomatic Python (e.g. [1]), my understanding would be much better.
wow - the first couple of paragraphs make it seem like brainfck! I love the part about using . for multi word variables because in a past version of a previous language _ was used for assignment! And thus the . can not be used for methods and instead they use $. holy crap. Yet somehow I am still strangely intrigued in a "this is as close to APL as I am going to get with out a magic keyboard" sort of way.
when I was looking into apl-esque paradigms the coolest thing I stumbled upon was a language called nialhttp://en.wikipedia.org/wiki/Nial - very clean and really good use of syntax! I am going to check out J for sure though - thanks.
Most younger R programmers use _ for multiword names. Using . is generally not recommended as it is more commonly used to identify generic methods in the S3 object system.
Good resource, i had to start using R recently and most of the examples and books i found were of the "stats with R" variety which all emphasise how to just roll along with the library functions. The general advice i got from some statisticians was to find someone else's code that kind of works and copy|paste. Blurg
If you haven't tried it already, I recommend you take a look at NumPy, which is the Python module for doing array math. R is great, but as a Python programmer, I really prefer staying in Python to using R or Matlab for numerical stuff.
It doesn't have quite the shortcuts for making basic stuff completely trivial (in the 10-50 LOC range), but for anything with more structure, I find it generally works out better in the end.
It is sometimes possible to use = for assignment, though I don't understand when this is and is not allowed. Most people avoid the issue by always using the arrow.
Somehow this does not seem like an auspicious starting statement!
In a couple of semesters writing medium-complexity R programs, I never had any problems using = for assignment. I'd recommend it, as it's much easier to type than <-, and looks more natural coming from a programming background.
Yes, but do you know the rules for when this is or isn't allowed?
I guess I come from a background of looking at big applications and finding points failure where someone did something that would "probably work" - ie, it works till you allocate 5 megs of memory or....
I think the issue is assignment in R is an expression rather than a statement (I think), but there are some other places where '=' gets used for different syntax, and you always use <- for assignment, even in those situations. For me, it doesn't come up, because as a Python programmer I've fully bought into the idea that assignment should be a statement, and so I don’t try to use it as an expression in code. If you’re used to Python, then you’ll be used to seeing "=" for both assignment and keyword function arguments, so there’s no real confusion.
I've never had a problem, but again, I've never tried to write R libraries for public consumption, or hack on large chunks of existing R code, so YMMV.
R is a superb prototyping language for statistical work, but making it work right for batch work is unnecessarily difficult IMHO. Still, an immensely useful tool.
This is a good article, but the very first example is perhaps a bit ill-chosen. The mass-energy equivalence formula doesn't assign mc^2 to e, it states that the two sides are always equal. The equality operator (== in C), would probably be more appropriate.
R is one of my favorite tools and I heartily recommend it to any hacker for data visualization alone. I've used R to make sense of high-n high dimensional data and it's a delight (even if the syntax takes a little getting used to).
As Buckwild said, best way to learn R is by messing around with it; There's in-editor help and a REPL. Download the GUI for your OS, not just the command-line tool; it has nice package management and graphical output (to a quartz window in os x).
If you're thinking of using R for plotting as well as analysis, I heartily heartily recommend the ggplot2 package. ( http://had.co.nz/ggplot2/ ) -- there's a lively google group for support and the output is far better than comparable packages (like lattice, my second favorite).
The other famous book for R isn't actually for R -- it's for S. http://www.stats.ox.ac.uk/pub/MASS4/ R is the open-source superset implementation of S/S-plus.
I want to recommend all of Hadley Wickham's R packages, actually. Ggplot2 is one of the best R plotting packages around, easily, but --- since one of the biggest initial problems with learning R is figuring out how to use the 20-or-so built-in functions to manipulate data to the right shape --- I have to doubly-recommend Plyr and Reshape as well.
I think that's the real way to learn R. Play with it until you're thoroughly frustrated, then download a few packages like Reshape and learn them. They'll probably have better documentation and typically have some really specific use cases which will help you understand how to use R toward its strengths.
30 comments
[ 3.5 ms ] story [ 92.4 ms ] threadI picked up R 2 weeks ago at work. I didn't know anything about it and I sucked at using it. I am proud to say that after 2 weeks of hard work, cursing at the computer monitor and beating my head against the cubicle wall, I am dramatically better than I was-- comparable to the experienced R programmers who work here.
Absolutely true, but you still need something to read to introduce you to the basic syntax and the general concepts of the language. Having a bridge between a known language and a new language can significantly speed this phase up, and get you quickly to the point where you're able to start experimenting.
That said, I only learned enough of R to get it to do what I wanted. The help in the interactive mode was all I really had to go off of then, and that was very helpful with plenty of examples. Being a relatively uncommon, single-letter language name, google wasn't giving me anything useful at the time. I see that is now much improved now, but this tutorial - mapping it to other languages and explaining syntax gotchas - would have saved me several hours of ramp-up for the simple tasks I wanted to accomplish.
This is really good method, but doing it alone may not teach you the correct paradigms of the language. You can write FORTRAN in any language, but you probably shouldn't.
If I were about to learn Python by just converting some PHP fragments, I would surely miss those characteristics that seperate Python from PHP. However, by reading other people's code or reading some documents on idiomatic Python (e.g. [1]), my understanding would be much better.
[1] - http://python.net/~goodger/projects/pycon/2007/idiomatic/han...
The official help docs are very good, also the extensions guide is pretty vital if you're linking to c etc. http://cran.r-project.org/manuals.html
Also the ESS(emacs speaks statistics) extension is really really good, well certainly if you're doing something statisticy with R.
It doesn't have quite the shortcuts for making basic stuff completely trivial (in the 10-50 LOC range), but for anything with more structure, I find it generally works out better in the end.
Somehow this does not seem like an auspicious starting statement!
I guess I come from a background of looking at big applications and finding points failure where someone did something that would "probably work" - ie, it works till you allocate 5 megs of memory or....
I've never had a problem, but again, I've never tried to write R libraries for public consumption, or hack on large chunks of existing R code, so YMMV.
As Buckwild said, best way to learn R is by messing around with it; There's in-editor help and a REPL. Download the GUI for your OS, not just the command-line tool; it has nice package management and graphical output (to a quartz window in os x).
If you're thinking of using R for plotting as well as analysis, I heartily heartily recommend the ggplot2 package. ( http://had.co.nz/ggplot2/ ) -- there's a lively google group for support and the output is far better than comparable packages (like lattice, my second favorite).
The other famous book for R isn't actually for R -- it's for S. http://www.stats.ox.ac.uk/pub/MASS4/ R is the open-source superset implementation of S/S-plus.
Download R and give it a shot: http://cran.r-project.org/mirrors.html
I think that's the real way to learn R. Play with it until you're thoroughly frustrated, then download a few packages like Reshape and learn them. They'll probably have better documentation and typically have some really specific use cases which will help you understand how to use R toward its strengths.
1- http://www.joeconway.com/plr
2- http://cran.r-project.org/web/packages/RPostgreSQL/index.htm...