Hacker News new | past | comments | ask | show | jobs | submit login
R for Programmers (ucdavis.edu)
59 points by voberoi on Oct 19, 2009 | hide | past | favorite | 22 comments

There are a few minor errors:

* the explanation of 8.6 is wrong - it's cbind that's coercing all columns to a common type, not data.frame

* 8.7 is a bad example of good R code - use column names not indices!

* in 9 (and elsewhere) it's not necessary to continually strips names off vectors or use return in functions

* 11.2.1 to count TRUEs in logical vector, sum it.


I took Prof. Matloff's class about a year ago. I recall him giving out extra credit for mistakes found in his materials. Please send in any errors/comments/suggestions you've found, he appreciates feedback and interest. He's more than willing to explain any curiosities in why he chose to do something, a rare trait that makes a good teacher.

Please could you forward these comments to the author? Considering he is offering the pdf for free, he may take errata as well. Thanks!

Good suggestion. Done.

I write PHP and some perl, and recently learned R. This guide would have been useful to me at the beginning. What it does well is that it jumps right into concepts that programmers will naturally wonder about and already conceptually grok. It wastes no time on explaining basic programming concepts, nor does it dig deep into esoteric R-isms. It helps you translate your PHP/Perl/Java/whatever mindset into the R language. An extremely useful introductory document.

My mother has a PhD in Cognitive Linguistics and is working at UCSC. She is using R, she hasn't programmed before, so I wonder how well she is doing with R. Well, I will meet her again around Christmas, maybe I could help her out a bit with R, I'm sure there's saomething she has missed, since she's a non-programmer.

What kind of functionalities is she using? I'm working on some articles and an app to help people learn R, especially people who are scared of programming or don't like it. I'm interested in learning what problems R beginners in different fields face. Feel free to drop me a line (see email in profile).

I'm talking with her on Skype atm, she's telling me that she hasn't starting using it yet, but that she went to a course at UCSB held by Stefan Th. Gires about R.

She is going to start using it in January when she gets some new corpus material.

She also said that they are going to use Tinn-R.

Sounds good. Tinn-R is a popular editor for R, although I prefer emacs+ess. Good luck to your mum!

... a super handy dandy resource for programmers new to R.

most of my issues with r can be traced back to the nonintuitive (for me) data structures. i found http://www.amazon.com/Data-Manipulation-R-Use/dp/0387747303 to be the most concise guide for how to manipulate common data structures.

This PDF has been the most helpful reference for me while learning R this last year.

"...who want to do statistics", right? Are there any good use cases for R for other stuff? (Or some interesting ways you used statistics as a "working programmer" recently?)

It's an introduction for those already familiar with some of the concepts that have to be extensivly explained in introductions for, say, social scientists.

I have to add, though, that I (as a non-programmer and aspiring social scientist) liked this tutorial much better than many other R tutorials out there. In know a little bit about programming but that was enough to pretty much understand the whole tutorial. (I have the sneaking suspicion that I'm an outlier so don't expect many other social scientists to know about basic CS concepts.)

(And boy am I happy that I now can feel confident ditching SPSS in favor of R. That gruesome SPSS!)

1) Well, machine learning is basically computational statistics, and machine learning is key to a lot of web apps.

2) The graphics in R are pretty good. I've used matlab and matplotlib and gnuplot. I'd say comparable functionality to matplotlib in 2D, with better 3D graphics via rgl (though I guess in that case you'd use a python OpenGL library).



How long does it take to learn R compared to (for example) Perl?

I don't know about Perl, but if you want to get up and running with R for some basic data analysis, I'd say:

1 week to get used to the syntax and do basic data manipulation such as contructing, editing data frames, reading and writing files etc. You can also get going with the simple graphing functions quite quickly.

1 week to learn the statistical stuff - scatter plotting, correlations, linear regression modelling. Of course, I'm talking about just learning the basic syntax. Doing regression properly could take a long time to learn.

The R Book by Crawley is quite a good introduction, especially if you want to brush up on some basic statistics. It's not very in-depth though, so you might have to move on to more advanced texts after a month or so.

I've used R since 1.4 ~ (2001). Compared to other dynamic languages, I think it's harder than most. Why? Because there's a lot more semantics. There might be R one order of magnitude more keywords for R than for Perl, Ruby or Python (PHP doesn't count :) ). There are two object systems, none of them very intuitive. You need to learn functional programming. 1600 packages and counting means more functions and deep concepts to understand. And last, you need to understand the math of whatvever it is you are using. Forget doing point-and-click, black-box analyses on SPSS.

Downsides include poor programming tools/debugger and pass-by-value. Still, it's one of my favorite languages.

This is a good resource to start. Then it might be better resources (there are some other tutorials around) but as a beginner in R I found it very good.

-1 for not mentioning mapply, tapply, or sapply.

Is there something like this for MATLAB?

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