Supplementary R code