R scripts for programming assignment 2