moving analysis to .Rmd