Placed my solution into R file from the Coursera repo