Cleaning the R analysis code