Monday, 30 January 2006

R wastes my time

I have just wasted about two hours of my life trying to figure out how to make R draw a line graph (all I want to do is plot the conditional mean of a variable on the Y axis for certain categories of another variable) to stick in my undergraduate methods lecture for tomorrow—a graph I could have constructed trivially in Stata, Excel, or SPSS in about 15 seconds. This is patently ridiculous.

I am not an idiot; this should not be so hard to figure out. I like R, but it is actively user-hostile (even with Rcmdr and other packages loaded), and until it ceases to be such I will not foist it on my students.

3 comments:

Any views expressed in these comments are solely those of their authors; they do not reflect the views of the authors of Signifying Nothing, unless attributed to one of us.

The solution (finally!): first, we have to get the conditional means.

means <- tapply(dependent_variable, independent_variable_as_a_factor, mean, na.rm=T)

Then, we can plot it, taking care to make the right labels on the X axis:

plot(means, axes=F)
axis(2)
axis(1, 1:length(means), names(means))

Add spiffy labels as appropriate. UGH!

 

Amen brother. There is a lot of money out there just waiting for a really good R how-to book. Think fo the sales at ICPSR alone.

 

I actually think John Fox’s book is pretty good, but nothing like this is covered in it.

Something like the O’Reilly “Hacks” or “Cookbook” series for R would be most helpful. And, if I had the time to write a book proposal…

 
Comments are now closed on this post.