R/output_analyses.R

#' Output analyses
#'
#' Output analysis plan specified in the json file
#'
#' @param study A study list object created with pipeline()
#' @return The study object

output_analyses <- function(study) {
  cat("## Analyses\n\n")

  for (i in 1:length(study$analyses)) {
    cat("###", study$analyses[[i]]$name, "\n\n")

    func <- study$analyses[[i]]$func
    params <- study$analyses[[1]]$params

    keys <- names(params)
    vals <- unlist(params) %>% unname()
    x <- c()
    for (j in 1:length(keys)) {
      x[j] <- paste0(keys[j], " = ", vals[j])
    }

    cat("We will run `",
        func, "(", paste0(x, collapse = ", "), ")`\n\n\n",
        sep = "")
  }

  invisible(study)
}
debruine/pipeline documentation built on May 8, 2019, 8:59 a.m.