r script to ready the data set