R code for analysis and file writing, readme and codebook