s = system.file("misc", "stitch-test.R", package = "knitr")
if (interactive()) stitch(s) # compile to PDF
# HTML report
stitch(s, system.file("misc", "knitr-template.Rhtml", package = "knitr"))
# or convert markdown to HTML
stitch(s, system.file("misc", "knitr-template.Rmd", package = "knitr"))
unlink(c("stitch-test.html", "stitch-test.md", "figure"), recursive = TRUE)
Run the code above in your browser using DataLab