copy of Ch12.Rnw
add R code
start of ch13