Stuff I Routinely Forget How to Do

A surprisingly important hunk of my bioinformatic skill set consists of Googling for error messages and implementing whatever fix the, say, StackOverflow posters suggested. I’ve collected the wisdom gleaned from such forums, man pages, and other programmers into this (newly relocated and expanded) document on GitHub: Stuff I Routinely Forget How to Do. I’m sure I’ll refer to it often and hopefully someone else will find it useful.


(Elephant photo by Flickr user guido da rozze.)

Named Colors in R

I spend too much time picking out colors for plots. R knows the names of 657 of them, but sometimes I don’t know if I’m in the mood for steelblue3 or steelblue4. I have this handy function in my .Rprofile file which takes a search string such as “blue” and returns a plot showing all colors with matching names.

plot.color.matches = function ( {

	matches = colors()[grep(, colors())]

	barplot(rep(1, length(matches)), col=matches, 
		pch=16, names=matches, las=2, cex.names=0.5, axes=FALSE)


You can call it with








to see all matching colors side by side.

R Named Colors - Blues


I’ve decided on “deepskyblue4″ for the current plot.