knitr::opts_chunk$set( echo = TRUE, message = FALSE, warning = FALSE )
This is an example report that was created using the pwdthemes::pwd_report
template. This template provides a set pdf layout for making reports in R that are styled with PWD logos. This template was designd with the hopes that it will reduce the burden of styling pdf outputs on users. Often, LaTeX can be a major headache if you are not familiar with it. In order to help you avoid these headaches, I have compiled some of the things I have figured out regarding LaTeX styling for you here, so that you don't have to think about it.
This template will include two images. Both of these images will be in the images/
directory that is created when you select this template. The first is named logo.png
and this is the water department logo with the commissioner's, Randy Hayman, name. This logo will appear only on the title page above the title information. If you want to use a different PWD logo option, you can either specify the path using the logo
YAML option or you can replace the logo.png
file in the images folder. The second is named footer.png
and is the equal oppurtunity text that is a requisite of all PWD documents. This footer will appear on every page at the bottom of the page. The footer can be removed by removing the footer: true
option from the yaml header of by setting it to false
.
The pageheader
yaml option allows you to set what will be displayed along the heading of each page on the right hand side. This text will be bolded. It will be on the right hand side of the header, opposite the section name which will be on the left hand side. If you do not want a pageheader, you can remove this argument.
This template also creates commands that can be used to create full-page landscape figures. You would implement it by doing the following:
\newpage \blandscape
knitr::include_graphics("images/logo.png")
\newpage \elandscape
The \blandscape
function stands for "Begin Landscape" and starts the new page as a landscape rather than portrait. Likewise, the \elandscape
function stands for "End Landscape" and ends the landscape on the next page.
Outside of the features mentioned above, all of the normal Rmarkdown features should be applicable to this theme as well. If you find any bugs, please file an issue at the Github repo
The benefit of using Rmarkdown is that you can easily integrate your text and code into a single document which can then be easily rendered into a publication quality document. You can include R code by using "chunks" as follows:
library(ggplot2) library(dplyr) library(pwdthemes)
large_diamonds <- diamonds %>% filter(carat > 2.2)
You can embed R figures directly into the document.
large_diamonds %>% ggplot(aes(price, carat, color = cut)) + geom_point() + theme_bw() + labs( title = "Diamond Carat vs Price", subtitle = "Only Diamonds with carat > 2.2 shown" ) + scale_color_pwd("dark")
In addition to embedding R figures and code, you can also embed images in the document:
To see more ways to use Rmarkdwon and further capabilities, check out the Rmarkdown website and free online book
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.