~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Knit a Document in RStudio

Published on

Updated on

In case you were wondering how I got all the R code and output for the “Do females live longer than males?” page. There is actually a function in RStudio that allows one to compile a report based on code and it’s output.

First go to File->Knit Document. If this is your first time, then it will install RMarkdown, a dependency this tool needs to compile the report.

Once that is downloaded, it will let you choose between three different file formats (HTML, PDF, MS Word). For the purposes of blog posts, I like to output it in HTML so I can copy and paste the code. But for personal use, I like using PDFs

After you select the file format, hit compile, and voila! A nice neat compiled report is created for you. Here is a pdf example of the report I made.

Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter