R Programming assignment II