Fixed typos, added R code