finished ch2 of Advanced R