Wrote R script to process data