Skip to navigation

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

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 a thread (and those from mail agents that don’t reference properly, alas) and ~$ matches unreferenced messages. Default combination for pattern terms is AND.

Of course, use with the lovely limit command and maybe combine with a date range:

!~x . ~$ ~d <1w

(Note no space after the <).

How to install RGoogleDocs (on Ubuntu)

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 your system, but on Xubuntu Jaunty I needed to get:

sudo aptitude install libcurl4-gnutls-dev

This fixed the RCurl problem, but I installation of XML (also required, and also automatically installed when you install RGoogleDocs) failed with:

checking for xml2-config... no
Cannot find xml2-config
ERROR: configuration failed for package �XML�

You guessed it:

sudo aptitude install libxml2-dev

So here’s the whole thing for cut-and-paste:

sudo aptitude install libcurl4-gnutls-dev libxml2-dev

Then:

sudo R

Then, inside R:

install.packages("RGoogleDocs", repos = "http://www.omegahat.org/R")

Addendum

Just had to install RGoogleDocs again and had a different issue. It complained that it couldn’t get package bitops which seems to be a depenency for RCurl. First step (which I just learned):

install.packages("RGoogleDocs", repos = "http://www.omegahat.org/R", dependencies = TRUE)

was not sufficient in my case. Had to manually first

install.packages("bitops")

Addendum

Version 0.4.0, which you get from Omegahat, doesn’t work but throws an authentication failure when you try to load a spreadsheet.
Try version 0.4.1 (downloads a .tar.gz file). To install the file:

install.packages("~/downloads/RGoogleDocs_0.4-1.tar.gz",repos=NULL)

(of course, replace ~/downloads/ with the appropriate directory).
Doesn’t work for me (22/2/2011). I still get “unauthorized” when trying to access a document (I can access the list of documents just fine).

Emacs with ESS and AucTeX on Windows

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 use Vincent Goulet’s modified Emacs version. As an additional benefit, it comes as a convenient self-installing .exe file.

Thanks Vincent!

p.s. To get LaTeX on Windows, you will want to get MiKTeX. MiKTeX is very nice and can auto-install missing packages on the fly when you want to use them in a document.

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

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.

R flashmob #2 at stackoverflow.com

September 8th, 2009

This just in from Dan’s Decision Science News: Tonight at exactly 18:04 UK time, login at stackoverflow.com, post three questions you always wanted to ask about R, make sure you tag them “R”, and possibly stick around to answer some questions and to vote for good questions and answers. Sign the guestbook. More details at Dan’s blog. I haven’t been at R flashmob #1, so I’m curious what this will all be about. If you go to the collection of questions tagged R that are already at stackoverflow.com, it looks like one outcome is a really useful resource that is more easily accessible than the r-help archives. (This is not to diminish the r-help mailing list, which is still the number one resource to get very quick and very helpful answers to your R questions as they arise.)