# Creating PDFs and websites with the "knitr" package

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Just a fast note: I came across the R-package “knitr” which enables you to generate PDF files by mixing LaTeX and R code in one document. The result looks very nice and is great to create documentations, manuals and so on. I find knitr much easier to use than the quite popular SweaveÂ (but I guess this has to do with personal preferences). In fact, knitr uses Sweave and expands it.**Rcrastinate**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Also, you can create HTML files using R Markdown documents. Just imagine you write an article or create a website with statistical analyses or programming stuff in R. If you use the knitr package (which is, by the way, perfectly integrated into RStudio), you just run your LaTeX/R or HTML/R document as soon as you get new data or change little things and the whole document is automatically updated (including all plots, tables and so on).

Here is a very small example (in German), what this looks like. Hopefully, I will find the time and the reason to use this package within this blog…

Example: PDF

Example: HTML (R Markdown)

Have fun using knitr… or just shake your head in disbelief, why anyone would want to do such stuff đź™‚

To

**leave a comment**for the author, please follow the link and comment on their blog:**Rcrastinate**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.