R/postreg_pipeline.R

#' Generate evaluation file
#'
#' Creates a html file that contains the evaluation of the hypothesis and planned analyses.
#'
#' @param json_file_name a character vector specifying the json file name (and path).
#' @param data_file_name a character vector specifying the data file name (and path).
#'
#' @export
#'
postreg_pipeline <- function(json_file_name, data_file_name) {
  study <- pipeline(json_file_name, data_file_name)

  rmd_template <- system.file("rmarkdown/templates/evaluation_report/skeleton",
                              "skeleton.Rmd", package = "pipeline")
  rmd_template <- "evaluation_report.Rmd" # must exist in same dir

  # add safe filename checks
  filename <- paste("postreg_", study$name, '_evaluation', Sys.Date(), ".html", sep='')

  rmarkdown::render(rmd_template, output_file = filename, output_dir = NULL)

  save_pipeline(study, paste0("archive_",json_file_name))
}
debruine/pipeline documentation built on May 8, 2019, 8:59 a.m.