Script to prepare data to feed into R (for lda)