R code for reproducing analyses