# This script will be sourced by the website as the global setup script for R scripts
## knitr options I want set as default for all ('global') code chunks
knitr::opts_chunk$set(
eval = TRUE, # If FALSE, knitr will not run the code in the code chunk.
include = TRUE, # If FALSE, knitr will run the chunk but not include the chunk in the final document.
echo = FALSE, # If FALSE, knitr will not display the code in the code chunk above it’s results in the final document.
message = FALSE, # If FALSE, knitr will not display any messages generated by the code.
error = TRUE , # If FALSE, knitr will not display any error messages generated by the code
warning = TRUE, # If FALSE, knitr will not display any warning messages generated by the code.
cache = TRUE, # If TRUE, knitr will cache the results to reuse in future knits. Knitr will reuse the results until the code chunk is altered.
fig.align = "center") # How to align graphics in the final document. One of 'lef', 'right', or 'center'.
# small functions
## thumbnail function
library(htmltools)
thumbnail <- function(title, img, href, caption = TRUE) {
div(class = "col-sm-4",
a(class = "thumbnail", title = title, href = href,
img(src = img),
div(class = if (caption) "caption",
if (caption) title)
)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.