added extra r code to rmd file