#' Top Matter
#'
#' Included at the top of a report to inlcude the credo logo and other basic front matter.
#'
#' @export
credo_frontmatter <- function() {
cat("<script>
$(document).ready(function() {
$head = $('#header');
$head.prepend('<img src=\"https://www.credo.ca/wp-content/uploads/2017/10/credoblock.jpg\" style=\"margin: auto; display: block; width: 175px; \"/>')
});
</script>
<div style=\"clear: &nbps;\"></div>
")
}
#' Introduction
#'
#' Producces two column introductory text commonly used at the head
#' of reporting.
#'
#' @export
credo_knitrintro <- function() {
cat("
.column-left{
float: left;
width: 40%;
text-align: left;
}
.column-center{
display: inline-block;
width: 33%;
text-align: left;
}
.column-right{
float: right;
width: 40%;
text-align: right;
}
</style>
<div class=\"column-left\">
Brandon Bertelsen<br/>
Research Director<br/>
Credo Consulting Inc.<br/>
brandon.bertelsen@credo.ca<br/>
+1-647-287-1009</div>
<div class=\"column-center\">
Hugh Murphy<br/>
Executive Director<br/>
Credo Consulting Inc.<br/>
hugh.murphy@credo.ca<br/>
")
}
#' Knitr Options
#'
#' Included in the first chunk to set typical options
#' @export
credo_knitropts <- function(fig.width = 11, fig.height = 8) {
opts_chunk$set(
echo = FALSE,
message = FALSE,
comment = "",
fig.width = fig.width,
fig.height = fig.height,
warning = FALSE,
fig.align = 'center',
cache = FALSE
)
}
#' Plot options
#'
#' Included in the top of the report to set plotting options
#' @export
credo_plotopts <- function() {
theme_set(theme_economist() +
theme(
# plot.background = element_blank(),
# legend.background = element_blank(),
legend.text = element_text(size = 9),
legend.title = element_blank(),
legend.position = "top",
legend.text.align = 0,
legend.margin = unit(0.25,"pt")))
update_geom_defaults("bar", list(fill = "#6794a7"))
update_geom_defaults("text", list(color = "#555555"))
scale_colour_discrete <<- function(...) scale_colour_economist()
scale_fill_discrete <<- function() scale_fill_economist()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.