- Use multiple languages including R, Python, and SQL.
- Output formats include HTML, PDF, MS Word, Beamer, HTML5 slides, Tufte-style handouts, books, dashboards, shiny applications, scientific articles, websites, and more.


https://datascienceplus.com/r-markdown-how-to-insert-page-breaks-in-a-ms-word-document/
##### Pagebreak # Overview The raw data comes from ...

# Our function in Pseudocode
si_ggsave <- function(){
ggsave(lastplot)
if(add_logo){
logo <- image_read("~/ourlogo.png") %>%
#make the width of the logo match the width of the plot
image_crop(paste0(pwidth, "x0+0+0"))
# The final version is stacked on top of the sorenson logo
final_plot <- image_append(c(lastplot, logo), stack = TRUE)
# And then we overwrite the standard ggsave call
image_write(final_plot, filename)
}
}
Setup chunk: over 100 lines
Part 1
Part 2
Move all settings into broad "apply_settings()" type functions
si_ggplot_theme_apply <- function() {
ggplot2::update_geom_defaults("bar", list(fill = si_design$pacific))
ggplot2::update_geom_defaults("smooth", list(
colour = si_design$pacific,
fill = si_design$arctic, alpha = I(2/10)))
ggplot2::update_geom_defaults("point", list(
colour = si_design$pacific,
fill = si_design$pacific))
ggplot2::update_geom_defaults("col", list(fill = si_design$pacific))
ggplot2::theme_set(ggplot2::theme_minimal())
}
# Our draft function in Pseudocode
si_draft_full_report <- function(file) {
if(empty(dirname(file))) { #Create dir if not provided
file <- file.path(default_dir, file)
}
if(tools::file_ext(file) != "Rmd") { #Fix the capitalization of Rmd
message("Daniel you messed up the capitalization again. Setting extension to .Rmd")
file <- paste0(tools::file_path_sans_ext(file), ".Rmd")
}
rmarkdown::draft(file = file,
template = "si_full_report",
package = "sorensonimpact",
edit = F)
file.edit(file) #Open immediately in Rstudio editor
}
One final piece…
One final piece…
<!DOCTYPE html>
<script>
$(function() {
$('#container').highcharts({
xAxis: {
categories: [<!--rinline I(shQuote(dates)) -->]
},
series: [{
name: 'Tokyo',
data: [<!--rinline I(Tokyo) -->]
}, {
name: 'London',
data: [<!--rinline I(London) -->]
}]
});
});
</script>
for (county in unique(utah$County)) {
try(render('./county_report.Rmd',
output_file = paste(county, "County Report.docx"),
output_dir = "./County_Reports/"))
}
Create a script that
Automate the Script
https://www.r-bloggers.com/scheduling-r-markdown-reports-via-email/