R programming week 3 assignment by Themosp