R code for Hackathon