Writing R Functions 36-402, Advanced Data Analysis 5 February 2011 The ability to read, understand, modify and write simple pieces of code is an essential skill for modern…