Supplementary R scripts and examples for papers