R/prereg_pipeline.R

#' Generate preregistration file
#'
#' Creates a html file that contains the hypotheses and planned analyses.
#'
#' @param json_file_name	a character vector specifying the file name (and path).
#'
#' @export
#'
prereg_pipeline <- function(json_file_name) {
  study <- pipeline(json_file_name)

  rmd_template <- system.file("rmarkdown/templates/prereg_report/skeleton",
                              "skeleton.Rmd", package = "pipeline")
  rmd_template <- "prereg_report.Rmd" # must exist in same dir
  # add safe filename checks
  filename <- paste("prereg_", study$name, '_', Sys.Date(), ".html", sep='')

  rmarkdown::render(rmd_template, output_file = filename, output_dir = NULL)
}
debruine/pipeline documentation built on May 8, 2019, 8:59 a.m.