Create functions.r

Created by Maurits to generate data set for running example throughout book