Incorporate some knitr code

Still problematic use of base.dir path but root.dir works