Skip to navigation

Archive for September, 2009

R: watch out when comparing vectors using “==”

Friday, September 25th, 2009

This question was on the R-help mailing list today: I have a data frame “test”: test test$total [1] 7 7 8 8 9 9 10 10 to this: > rep(needed,length.out=length(test$total)) [1] 7 9 7 9 7 9 7 9 The two vectors just happen to coincide at test$total[1] and test$total[6]. The recycling is of course […]

mutt: match messages that started a thread and have no replies

Wednesday, September 16th, 2009

Thanks to the helpful people on mutt-users. As the title says. Mainly useful for mailing lists like r-help — questions that still need answering. (As if I knew any answers to r-help questions, ha.) !~x . ~$ Note it combines ~x which looks into the “References:” header, so !~x . means “No References header”, i.e., […]

How to install RGoogleDocs (on Ubuntu)

Monday, September 14th, 2009

RGoogleDocs is not available from CRAN, but from Omegahat.org. To install, sudo R, then install.packages(“RGoogleDocs”, repos = “http://www.omegahat.org/R”) RGoogleDocs requires RCurl, and will automatically install it. However, for me, this resulted in the error message: checking for curl-config… no Cannot find curl-config and RGoogleDocs was not installed. This is in fact in the RCurl FAQ. […]

Emacs with ESS and AucTeX on Windows

Monday, September 14th, 2009

I will have to use MS Windows for my new job, at least some of the time. I’ll put related posts in a new “MS Windows” category. If you use R, you most likely want ESS (Emacs Speaks Statistics) for your GNU Emacs. If you use LaTeX, you will also want AucTeX. I highly recommend […]

R: create several plots with automatic generation of filenames in a loop

Tuesday, September 8th, 2009

Found on stackoverflow.com. I didn’t know about this way to make R automatically generate filenames for a series of plots: jpeg(“~/tmp/rplots/foo%02d.jpg”) for (i in 1:5) { plot(i,ylim=c(0,6)) } dev.off() I’m actually not sure whether R does this, or the Linux shell.