R solutions for project2