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 rep(7,length.out=length(test$total))
[1] 7 7 7 7 7 7 7 7
will do just fine.
To get the help text on %in% by the way, you need to quote it:
?”%in%”

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., messages that started [...]

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. The solution may differ for [...]

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 you [...]

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.