script of R for learning purposes