R Script

Complete R Script to accomplish the task