transferring R code into jss.Rnw