R code

R code for data management and code for the actual analysis