Update functions.r

Fix previous error where the end of file was missing