A solution R file for the second assignment for the course