solution for programming assignment of coursera "R Programming"