R script to obtain tidy data