Notes on Advanced R by Hadley Wickham.