R/nciea_report.R

Defines functions new_nciea_report

Documented in new_nciea_report

#' Create a new report using the NCIEA RMarkdown template
#'
#' @param file_name The name of the file for your RMarkdown document. Defaults to "new_report" and creates a file called report.Rmd
#' @param type_of_report The type of report you're creating (only "nciea_report" currently)
#'
#' @return
#' @export
#'
#' @examples
new_nciea_report <- function(file_name = "new_report",
                            type_of_report = "nciea_report") {

  if (is.null(type_of_report) | toupper(type_of_report) %in% c("NCIEA_REPORT", "GENERAL")) {
    type_of_report = "nciea_report"
  } else {
    stop(paste(shQuote(toupper(type_of_report)), "not supported.  Please select", shQuote("NCIEA_REPORT"), "or", shQuote("GENERAL")))
  }

  rmarkdown::draft(file = stringr::str_glue("{file_name}.Rmd"),
                   template = type_of_report,
                   package = "Literasee",
                   create_dir = FALSE,
                   edit = FALSE)
}
CenterForAssessment/Literasee documentation built on July 2, 2023, 6:21 p.m.