# Blog Archives

## Curved arrows in R

October 10, 2012
By

I briefly investigated how to draw curved arrows in R. Here’s a small piece of the figure that I ultimately created: A google search for “curved arrows in R” revealed three options: curvedarrow in the diagram package The internal function igraph.Arrows within the igraph package (mentioned by Gabor Csardi in R help) Using xspline for

## Learning a new language

June 21, 2012
By

It had been a very long time since I’d tried to learn a new programming language. I started C in 1987, S in 1992, and Perl in 1997, but nothing really new in the subsequent 15 years. A friend now has me doing D, wanting to find time to learn ruby, and, most recently, playing

## A course in statistical programming

May 25, 2012
By

Graduate students in statistics often take (or at least have the opportunity to take) a statistical computing course, but often such courses are focused on methods (like numerical linear algebra, the EM algorithm, and MCMC) and not on actual coding. For example, here’s a course in “advanced statistical computing” that I taught at Johns Hopkins

## Should I be nice?

May 18, 2012
By

I got the following email. Subject: i have a question? Date: May 18, 2012 7:57:56 AM CDT how can i enter the data of QTL analysis. That was the whole thing. I presume that the writer wishes to use my R/qtl software. I could probably respond helpfully (for example, “See the sample data files and

## as.character() for rownames()

March 22, 2012
By

Rainer pointed out, in response to my post, Row names in data frames: Beware of 1:nrow, that if I’d used rownames(x) <- as.character(1:3) rather than rownames(x) <- 1:3, I wouldn’t have had the problem I’d seen. If you type rownames(x) you see the same result as rownames(z), and is.character(rownames(x)) and is.character(rownames(z)) both return TRUE, but

## Row names in data frames: beware of 1:nrow

March 21, 2012
By

I spent some time puzzling over row names in data frames in R this morning. It seems that if you make the row names for a data frame, x, as 1:nrow(x), R will act as if you’d not assigned row names, and the names might get changed when you do rbind. Here’s an illustration: As

## Halloween 2011 count

October 31, 2011
By

We don’t get many kids seeking candy at our house. I’m not sure if there just aren’t many kids in the neighborhood, or if it’s our location (next to the pond, with a big gap before the next house). I decided to keep track. As usual, we bought a huge bag of candy, and we

## Ghastly R code

September 27, 2011
By

My R package, R/qtl, contains about 33k lines of R code (and 21k lines of C code). Some of it is quite good; some of it is terrible. Here’s another example of the terrible. I’ve long needed to revise the function scantwo, for performing a two-dimensional genome scan for pairs of loci. I was looking

## Gamified

September 26, 2011
By

Barry Rowlingson gave an interesting talk at UseR 2011, “Why R-help must die!” He suggested the Q-and-A type sites Stack Overflow (on programming) and Cross Validated (on statistics), both part of Stack Exchange. An interesting feature of these sites is that, in addition to voting up and down on the questions and answers, one accrues

## Quick labels within figures

August 26, 2011
By

One of the coolest R packages I heard about at the useR! Conference: Toby Dylan Hocking‘s directlabels package for putting labels directly next to the relevant curves or point clouds in a figure. I think I first learned about this idea from Andrew Gelman: that a separate legend requires a lot of back-and-forth glances, so