R script for getting clean data