Various bits of R code.