R code accompanying Olsen et al. Genomics, 2014