R programming assignment 3