simulation code inserted in Rmd file