r script for programming assignment 2 completed