R file with my code and clarifying comments