Solutions to Assignment 2 for R Programming course