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.