#' Function which bulid template for ENR report
#'
#' @param file Rmd file name which we want to create.
#' @param subdir subdirectory name where we want to store our report. Default value: 'reports'
#' @examples
#' \dontrun{
#' build_enr_report('001_initial_report')
#' }
build_enr_report <- function(file, subdir = "reports"){
file_name <- paste0(subdir, "/", file, ".Rmd")
files_cnt <- list.dirs(subdir) %>% length()
if (files_cnt == 1) {
rmarkdown::draft(file_name, template = "enr_report", package = "ENRanalytics", edit = FALSE)
load_html_files(path = report_system_file(''))
report_show(subdir, file, paste0(file, '.Rmd'))
}
else if (files_cnt == 0) {
warning(paste0("There is no subdirectory '", subdir, "' in your project. Please use correct name."), call. = FALSE)
}
else if (files_cnt > 1) {
rmarkdown::draft(file_name, template = "enr_report", package = "ENRanalytics", edit = FALSE)
report_show(subdir, file, paste0(file, '.Rmd'))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.