R Programming, assignment for week 4