Completed the inverse assignment for coursera "Programming with R"