R programming Week 4 Programming Assignment