R scripts from Hadley Wickham's chapter on functions