R/GetReportFileNames.R

Defines functions GetReportFileNames

Documented in GetReportFileNames

#' GetReportFileNames
#'
#' Get the list of report file names in a specific folder. By default the search folder is
#' \code{reports} folder installed with package \code{\link{hivEstimatesAccuracyReloaded}}.
#'
#' @param path Path to the folder with adjustment specifications. Optional.
#'   Default = \code{\link{system.file}("reports", package = "hivEstimatesAccuracyReloaded")}.
#'
#' @return Character vector of adjustment specification file paths.
#'
#' @examples
#' \dontrun{
#' GetReportFileNames()
#' }
#'
#' @export
GetReportFileNames <- function(
  path = system.file("reports", package = "hivEstimatesAccuracyReloaded"))
{
  reportFileNames <- list.files(path,
                                pattern = ".Rmd$",
                                full.names = TRUE)

  reportNames <- sapply(reportFileNames, ReadRmdFrontMatter, section = "name")

  names(reportFileNames) <- reportNames

  return(reportFileNames)
}
nextpagesoft/hivEstimatesAccuracyReloaded documentation built on March 14, 2020, 7:06 a.m.