Added R implementation for exercise 02