Appendix A1: R Main script

Work in progress [..]