R script for generating the tidy data set